Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
doc(core): write up the difference between a `Linter` and a `PatternLinter`
Elijah Potterc1572a4fa3b4
diff --git a/packages/web/src/routes/docs/contributors/faq/+page.md b/packages/web/src/routes/docs/contributors/faq/+page.mdnew file mode 100644index 000000000..e51a386c0--- /dev/null+++ b/packages/web/src/routes/docs/contributors/faq/+page.md@@ -0,0 +1,18 @@+---+title: Frequently Asked Questions+---++This page will be composed of frequently asked questions for contributors.+If you're reading this page, you might also be interested in [the main FAQ page](/docs/faq).++## What's the Difference Between a `Linter` and a `PatternLinter`?++++A [`Linter`](https://docs.rs/harper-core/latest/harper_core/linting/trait.Linter.html) is a Rust trait for a type that queries a [`Document`](https://docs.rs/harper-core/latest/harper_core/struct.Document.html) to identify grammatical errors, returning a human-readable list of errors, optionally with suggestions that could resolve them.++A [`PatternLinter`](https://docs.rs/harper-core/latest/harper_core/linting/trait.PatternLinter.html) is another Rust trait for a type that can hook into the `PatternLinter` framework.+The `PatternLinter` provides a pattern, which the framework locates inside of documents.+When a sequence of tokens is matched, they are provided to `match_to_lint` to map the match to a human-readable error.++All types that implement `PatternLinter` also implement `Linter` thanks to a [blanket implementation](https://doc.rust-lang.org/reference/glossary.html?highlight=blanket#blanket-implementation) of the latter upon the former.diff --git a/packages/web/static/images/linter_diagram.png b/packages/web/static/images/linter_diagram.pngnew file mode 100644index 000000000..08dddade3Binary files /dev/null and b/packages/web/static/images/linter_diagram.png differdiff --git a/packages/web/vite.config.ts b/packages/web/vite.config.tsindex ce79276ca..136bb471f 100644--- a/packages/web/vite.config.ts+++ b/packages/web/vite.config.ts@@ -143,6 +143,10 @@ export default defineConfig({title: 'Reviewing Pull Requests',to: '/docs/contributors/review',},+ {+ title: 'FAQ',+ to: '/docs/contributors/faq',+ },],},{