Skip to content

Offline, privacy-first grammar checker. Fast, open-source, Rust-powered

feat(web): moved documentation to the website

Elijah Potter4703e70db022
diff --git a/harper-ls/README.md b/harper-ls/README.md
index bfb40ada0..7ae7d2895 100644
--- a/harper-ls/README.md
+++ b/harper-ls/README.md
@@ -1,155 +1,3 @@
# `harper-ls`
-`harper-ls` is the [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) frontend for [Harper](https://writewithharper.com).
-Out of the box, it has built-in support for parsing the comments of most programming languages, as well as any and all markdown files.
-
-## Installation
-
-How you choose to install `harper-ls` depends on your use-case.
-Right now, we only directly support usage through [`nvim-lspconfig`](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#harper_ls).
-Refer to the linked documentation for more information.
-
-If you happen to use [`mason.nvim`](https://github.com/williamboman/mason.nvim), installation will be pretty straightforward.
-`harper-ls` is in the official Mason registry, so you can install it the same way you install anything through Mason.
-
-If you __don't__ install your LSPs through Mason, we have binary releases available on [GitHub](https://github.com/Automattic/harper/releases) or you can use one of a number of package managers.
-
-### Zed
-
-The [Zed plugin](https://github.com/Stef16Robbe/harper_zed) will automatically download `harper-ls` to your system if you don't already have it.
-
-### Cargo
-
-If you have [Rust installed](https://www.rust-lang.org/tools/install), you're in luck!
-To install `harper-ls`, simply run:
-
-```bash
-cargo install harper-ls --locked
-```
-
-### Arch Linux
-
-Harper is available through the `extra` repo:
-
-```bash
-sudo pacman -S harper
-```
-
-## Dictionaries
-
-`harper-ls` has three kinds of dictionaries: user, file-local, and static dictionaries.
-
-### User Dictionary
-
-Each user of `harper-ls` has their own dictionary, located in the following directories on each operating system:
-
-| Operating System | Location |
-| :--------------- | ---------------------------------------------: |
-| Linux | `$XDG_CONFIG_HOME/harper-ls/` |
-| MacOS | `$HOME/Library/Application Support/harper-ls/` |
-| Windows | `{FOLDERID_LocalAppData}/harper-ls/` |
-
-This dictionary is a simple line-separated word list in plain-text.
-You can add and remove words at will.
-You can add to the user dictionary with code actions on misspelled words.
-
-#### Configuration
-
-You don't have to stick with the default locations (listed above).
-If you use Neovim, you can set the location of the user dictionary with the `userDictPath` key, and the file dictionary with the `fileDictPath` key:
-
-```lua
-lspconfig.harper_ls.setup {
- settings = {
- ["harper-ls"] = {
- userDictPath = "~/dict.txt",
- fileDictPath = "~/.harper/",
- }
- },
-}
-```
-
-You can also toggle any particular linter.
-The default values are shown below:
-
-```lua
-lspconfig.harper_ls.setup {
- settings = {
- ["harper-ls"] = {
- linters = {
- spell_check = true,
- spelled_numbers = false,
- an_a = true,
- sentence_capitalization = true,
- unclosed_quotes = true,
- wrong_quotes = false,
- long_sentences = true,
- repeated_words = true,
- spaces = true,
- matcher = true,
- correct_number_suffix = true,
- number_suffix_capitalization = true,
- multiple_sequential_pronouns = true,
- linking_verbs = false,
- avoid_curses = true,
- terminating_conjunctions = true
- }
- }
- },
-}
-```
-
-By default, `harper-ls` will mark all diagnostics with HINT.
-If you want to configure this, refer below:
-
-```lua
-lspconfig.harper_ls.setup {
- settings = {
- ["harper-ls"] = {
- diagnosticSeverity = "hint" -- Can also be "information", "warning", or "error"
- }
- },
-}
-```
-
-You can also configure how `harper-ls` displays code actions.
-For example, to make code actions appear in "stable" positions, use the following configuration:
-
-```lua
-lspconfig.harper_ls.setup {
- settings = {
- ["harper-ls"] = {
- codeActions = {
- forceStable = true
- }
- }
- },
-}
-```
-
-This was added in response to [issue #89](https://github.com/automattic/harper/issues/89).
-
-### File-Local Dictionary
-
-Sometimes, you'll encounter a word (or name) that is only valid within the context of a specific file.
-In this case, you can use the code action that adds the word to the file-local dictionary.
-Any words added to this dictionary will, like the name implies, only be included in the dictionary when performing corrections on the file at that specific path.
-
-You can find the file-local dictionaries in the following directories on each operation system:
-
-| Operating System | Location |
-| :--------------- | -----------------------------------------------------------------------------------------------: |
-| Linux | `$XDG_DATA_HOME/harper-ls/file_dictionaries` or `$HOME/.local/share/harper-ls/file_dictionaries` |
-| MacOS | `$HOME/Library/Application Support/harper-ls/file_dictionaries` |
-| Windows | `{FOLDERID_LocalAppData}/harper-ls/file_dictionaries` |
-
-The format of these files is identical to user dictionaries.
-
-### Static Dictionary
-
-The static dictionary is built into the binary and is (as of now) immutable.
-It contains almost all words you could possibly encounter.
-
-I _do_ take pull requests or issues for adding words to the static dictionary.
-It is composed of two files: `harper-core/dictionary.dict` and `harper-core/affixes.json`
-If you just want to add a proper noun, try running `just addnoun <your noun>`.
+Documentation for `harper-ls` has moved to the main [website](https://writewithharper.com/integrations/language-server).
diff --git a/justfile b/justfile
index fd96fb88b..17cbf46ef 100644
--- a/justfile
+++ b/justfile
@@ -151,6 +151,8 @@ setup:
just build-harperjs
just build-obsidian
just test-vscode
+ just build-harperjs
+ just test-harperjs
just build-web
# Perform full format and type checking, build all projects and run all tests. Run this before pushing your code.
diff --git a/packages/web/src/app.css b/packages/web/src/app.css
index d33956815..c4d85cf7c 100644
--- a/packages/web/src/app.css
+++ b/packages/web/src/app.css
@@ -3,16 +3,24 @@
@tailwind utilities;
@layer base {
+ ul {
+ @apply list-disc pl-4;
+ }
+
h1 {
- @apply text-5xl pt-4;
+ @apply text-5xl py-4;
}
h2 {
- @apply text-3xl sm:text-3xl lg:text-4xl pt-4;
+ @apply text-3xl sm:text-3xl lg:text-4xl py-4;
+ }
+
+ h3 {
+ @apply text-xl sm:text-xl lg:text-2xl py-4;
}
p {
- @apply lg:text-base md:text-xl xl:text-xl pt-4;
+ @apply lg:text-base md:text-lg xl:text-lg py-4;
}
* {
@@ -29,6 +37,14 @@
font-family: Atkinson Hyperlegible;
}
+code {
+ font-family: 'JetBrains Mono' !important;
+}
+
+code * {
+ font-family: 'JetBrains Mono' !important;
+}
+
.underlinespecial {
position: relative;
background-color: var(--bg-color);
diff --git a/packages/web/src/lib/Editor.svelte b/packages/web/src/lib/Editor.svelte
index ca547f5ad..b169cbfe3 100644
--- a/packages/web/src/lib/Editor.svelte
+++ b/packages/web/src/lib/Editor.svelte
@@ -81,7 +81,7 @@
>
<div class="pl-2 border-l-[3px] border-l-primary-500">
<div class="flex flex-row">
- <h3 class="font-bold">
+ <h3 class="font-bold text-base p-0">
{lint.lint_kind()} - “<span class="italic">
{lint.get_problem_text()}
</span>”
@@ -91,7 +91,7 @@
class="transition-all overflow-hidden flex flex-col justify-evenly"
style={`height: ${focused === i ? `calc(55px * ${lint.suggestion_count() + 1})` : '0px'}`}
>
- <p style="height: 50px" class="text-left text-sm">{lint.message()}</p>
+ <p style="height: 50px" class="text-left text-sm p-0">{lint.message()}</p>
{#each lint.suggestions() as suggestion}
<div class="w-full p-[4px]">
<Button
@@ -121,8 +121,8 @@
class={`max-w-full w-full ${superSmall ? 'justify-center' : 'justify-between'} flex-row ${small ? '' : 'hidden'}`}
>
<div class={superSmall ? 'hidden' : ''}>
- <h1 class={`font-bold p-0 ${small ? 'text-lg' : ''}`}>{lints[focused].lint_kind()}</h1>
- <p class={`p-0 ${small ? 'text-sm' : 'text-md'}`}>{lints[focused].message()}</p>
+ <h1 class={`font-bold p-0 text-lg}`}>{lints[focused].lint_kind()}</h1>
+ <p class={`p-0 text-sm`}>{lints[focused].message()}</p>
</div>
<div class="flex flex-row">
{#each lints[focused].suggestions() as suggestion}
diff --git a/packages/web/src/routes/docs/about/+page.md b/packages/web/src/routes/docs/about/+page.md
index cac3e0f6f..c04c980b9 100644
--- a/packages/web/src/routes/docs/about/+page.md
+++ b/packages/web/src/routes/docs/about/+page.md
@@ -2,7 +2,7 @@
title: What Is Harper?
---
-Harper is a grammar checker designed to run anywhere there's text (so really, anywhere).
+Harper is a grammar checker designed to run anywhere there is text (so really, anywhere).
Most Harper users are catching their mistakes in Neovim, [Obsidian](/obsidian), or Visual Studio Code.
<script>
@@ -22,4 +22,4 @@ In a way, Harper is an error-tolerant parser for English.
## How Can I Start Using Harper?
-That depends. If you want to use it to check your work,
+We have a number of integrations available for a number of use-cases, ranging from [Obsidian for note-taking](./integrations/obsidian) to [Neovim](./integrations/neovim) or [Visual Studio Code](./integrations/visual-studio-code) for programming.
diff --git a/packages/web/src/routes/docs/integrations/emacs/+page.md b/packages/web/src/routes/docs/integrations/emacs/+page.md
new file mode 100644
index 000000000..61d40420d
--- /dev/null
+++ b/packages/web/src/routes/docs/integrations/emacs/+page.md
@@ -0,0 +1,6 @@
+---
+title: Emacs
+---
+
+Our Emacs support is limited and primarily provided by the community.
+You can see the longer discussion [here](https://github.com/Automattic/harper/discussions/150).
diff --git a/packages/web/src/routes/docs/integrations/helix/+page.md b/packages/web/src/routes/docs/integrations/helix/+page.md
new file mode 100644
index 000000000..e48acc69a
--- /dev/null
+++ b/packages/web/src/routes/docs/integrations/helix/+page.md
@@ -0,0 +1,13 @@
+---
+title: Helix Support
+---
+
+To use Harper in [Helix](https://helix-editor.com/), you'll need to have `harper-ls` installed.
+
+Once you do, add this to you configuration:
+
+```toml
+[language-server.harper-ls]
+command = "harper-ls"
+args = ["--stdio"]
+```
diff --git a/packages/web/src/routes/docs/integrations/language-server/+page.md b/packages/web/src/routes/docs/integrations/language-server/+page.md
new file mode 100644
index 000000000..9cec19d66
--- /dev/null
+++ b/packages/web/src/routes/docs/integrations/language-server/+page.md
@@ -0,0 +1,68 @@
+---
+title: Language Server
+---
+
+`harper-ls` is the [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) frontend for Harper.
+Out of the box, it has built-in support for parsing the comments of most programming languages, as well as any and all markdown files.
+
+### Cargo
+
+If you have [Rust installed](https://www.rust-lang.org/tools/install), you're in luck!
+To install `harper-ls`, simply run:
+
+```bash
+cargo install harper-ls --locked
+```
+
+### Arch Linux
+
+Harper is available through the `extra` repo:
+
+```bash
+sudo pacman -S harper
+```
+
+## Dictionaries
+
+`harper-ls` has three kinds of dictionaries: user, file-local, and static dictionaries.
+
+### User Dictionary
+
+Each user of `harper-ls` has their own dictionary, located in the following directories on each operating system:
+
+| Operating System | Location |
+| :--------------- | ---------------------------------------------: |
+| Linux | `$XDG_CONFIG_HOME/harper-ls/` |
+| MacOS | `$HOME/Library/Application Support/harper-ls/` |
+| Windows | `FOLDERID_LocalAppData/harper-ls/` |
+
+This dictionary is a simple line-separated word list in plain-text.
+You can add and remove words at will.
+Code actions on misspelled words allow you to add elements to this list.
+
+This was added in response to [issue #89](https://github.com/automattic/harper/issues/89).
+
+### File-Local Dictionary
+
+Sometimes, you'll encounter a word (or name) that is only valid within the context of a specific file.
+In this case, you can use the code action that adds the word to the file-local dictionary.
+Any words added to this dictionary will, like the name implies, only be included in the dictionary when performing corrections on the file at that specific path.
+
+You can find the file-local dictionaries in the following directories on each operation system:
+
+| Operating System | Location |
+| :--------------- | -----------------------------------------------------------------------------------------------: |
+| Linux | `$XDG_DATA_HOME/harper-ls/file_dictionaries` or `$HOME/.local/share/harper-ls/file_dictionaries` |
+| MacOS | `$HOME/Library/Application Support/harper-ls/file_dictionaries` |
+| Windows | `FOLDERID_LocalAppData/harper-ls/file_dictionaries` |
+
+The format of these files is identical to user dictionaries.
+
+### Static Dictionary
+
+The static dictionary is built into the binary and is (as of now) immutable.
+It contains almost all words you could possibly encounter.
+
+I _do_ take pull requests or issues for adding words to the static dictionary.
+It is composed of two files: `harper-core/dictionary.dict` and `harper-core/affixes.json`
+If you just want to add a proper noun, try running `just addnoun <your noun>`.
diff --git a/packages/web/src/routes/docs/integrations/neovim/+page.md b/packages/web/src/routes/docs/integrations/neovim/+page.md
new file mode 100644
index 000000000..036ad64aa
--- /dev/null
+++ b/packages/web/src/routes/docs/integrations/neovim/+page.md
@@ -0,0 +1,116 @@
+---
+title: Neovim
+---
+
+[Neovim](https://neovim.io/) is a popular open-source text editor.
+Its lack of fast grammar-checking was the primary motivation for creating Harper.
+
+## Installation
+
+How you choose to install `harper-ls` depends on your use-case.
+Right now, we only directly support usage through [`nvim-lspconfig`](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#harper_ls).
+Refer to the linked documentation for more information.
+
+If you happen to use [`mason.nvim`](https://github.com/williamboman/mason.nvim), installation will be pretty straightforward.
+`harper-ls` is in the official Mason registry, so you can install it the same way you install anything through Mason.
+
+If you **don't** install your LSPs through Mason, we have binary releases available on [GitHub](https://github.com/Automattic/harper/releases) or you can use one of a number of package managers.
+
+### Cargo
+
+If you have [Rust installed](https://www.rust-lang.org/tools/install), you're in luck!
+To install `harper-ls`, simply run:
+
+```bash
+cargo install harper-ls --locked
+```
+
+### Arch Linux
+
+Harper is available through the `extra` repo:
+
+```bash
+sudo pacman -S harper
+```
+
+## Configuration
+
+Neovim is also one of the two primarily supported editors for `harper-ls`.
+As such, you can view this page as canonical documentation for the available configuration options.
+[Helix](./helix) and [Zed](./zed) users may find it helpful.
+
+### Dictionaries
+
+You do not have to stick with the default dictionary locations ([listed on this page](./language-server)).
+If you use Neovim, you can set the location of the user dictionary with the `userDictPath` key, and the file dictionary with the `fileDictPath` key:
+
+```lua
+lspconfig.harper_ls.setup {
+ settings = {
+ ["harper-ls"] = {
+ userDictPath = "~/dict.txt",
+ fileDictPath = "~/.harper/",
+ }
+ },
+}
+```
+
+### Linters
+
+Linters are grammatical rules Harper looks for to correct your work.
+You can toggle them on or off to your liking.
+
+```lua
+lspconfig.harper_ls.setup {
+ settings = {
+ ["harper-ls"] = {
+ linters = {
+ spell_check = true,
+ spelled_numbers = false,
+ an_a = true,
+ sentence_capitalization = true,
+ unclosed_quotes = true,
+ wrong_quotes = false,
+ long_sentences = true,
+ repeated_words = true,
+ spaces = true,
+ matcher = true,
+ correct_number_suffix = true,
+ number_suffix_capitalization = true,
+ multiple_sequential_pronouns = true,
+ linking_verbs = false,
+ avoid_curses = true,
+ terminating_conjunctions = true
+ }
+ }
+ },
+}
+```
+
+By default, `harper-ls` will mark all diagnostics with HINT.
+If you want to configure this, refer below:
+
+```lua
+lspconfig.harper_ls.setup {
+ settings = {
+ ["harper-ls"] = {
+ diagnosticSeverity = "hint" -- Can also be "information", "warning", or "error"
+ }
+ },
+}
+```
+
+You can also configure how `harper-ls` displays code actions.
+For example, to make code actions appear in "stable" positions, use the following configuration:
+
+```lua
+lspconfig.harper_ls.setup {
+ settings = {
+ ["harper-ls"] = {
+ codeActions = {
+ forceStable = true
+ }
+ }
+ },
+}
+```
diff --git a/packages/web/src/routes/docs/integrations/+page.md b/packages/web/src/routes/docs/integrations/obsidian/+page.md
similarity index 50%
rename from packages/web/src/routes/docs/integrations/+page.md
rename to packages/web/src/routes/docs/integrations/obsidian/+page.md
index af239ca9a..fbe378d91 100644
--- a/packages/web/src/routes/docs/integrations/+page.md
+++ b/packages/web/src/routes/docs/integrations/obsidian/+page.md
@@ -1,34 +1,21 @@
---
-title: Integrations
+title: Obsidian
---
-## Obsidian
+[Obsidian](https://obsidian.md/) is a popular Markdown editor and [Zettelkasten](https://en.wikipedia.org/wiki/Zettelkasten) knowledge vault.
+Its extensive plugin ecosystem makes it an attractive choice for note-taking students and documenting professionals.
+
+While one of main features of Obsidian is privacy, server-side LanguageTool is one of the most popular plugins.
+Harper aims to replace LanguageTool by being faster, better and entirely private.
+
+## Installation
![A screenshot of Obsidian with Harper installed](/images/obsidian_screenshot.webp)
To add Harper to [Obsidian](/obsidian), just install the community plugin.
-
More specifically, go to Obsidian's settings and click "Community Plugins."
You may be asked to enable them.
-
Next, click "Browse" and search for "Harper".
Finally, go back to the Community Plugins page and enable the plugin.
![A screenshot of the Harper Obsidian installation.](/images/obsidian_install_screenshot.webp)
-
-## Emacs
-
-Our Emacs support is limited and primarily provided by the community.
-You can see the longer discussion [here](https://github.com/Automattic/harper/discussions/150).
-
-## Helix
-
-To use Harper in [Helix](https://helix-editor.com/), you'll need to have `harper-ls` installed.
-
-Once you do, add this to you configuration:
-
-```toml
-[language-server.harper-ls]
-command = "harper-ls"
-args = ["--stdio"]
-```
diff --git a/packages/web/src/routes/docs/integrations/visual-studio-code/+page.md b/packages/web/src/routes/docs/integrations/visual-studio-code/+page.md
new file mode 100644
index 000000000..6b7f08cbf
--- /dev/null
+++ b/packages/web/src/routes/docs/integrations/visual-studio-code/+page.md
@@ -0,0 +1,19 @@
+---
+title: Visual Studio Code
+---
+
+With more than 14 million users Visual Studio Code is undeniably the most widely used programming environment in the world.
+Most programming languages support doc-comments, a type of inline comment used to generate public-facing documentation.
+
+- [Javadoc](https://en.wikipedia.org/wiki/Javadoc) for Java
+- [JSDoc](https://jsdoc.app/) for JavaScript
+- [Annex D](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/documentation-comments) for C#.
+- ... and many more
+
+The problem: most of these users aren't spending as sufficient amount of time ensuring their comments meet the editorial standards that readers expect.
+This can leave a poor first impression on readers.
+
+Fortunately, Harper can help!
+By parsing your comments and checking them for style, Harper can significantly improve the professionalism and readability of written documentation.
+
+Just search for "Harper" in the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=elijah-potter.harper) and hit install!
diff --git a/packages/web/src/routes/docs/integrations/zed/+page.md b/packages/web/src/routes/docs/integrations/zed/+page.md
new file mode 100644
index 000000000..98ad18d30
--- /dev/null
+++ b/packages/web/src/routes/docs/integrations/zed/+page.md
@@ -0,0 +1,10 @@
+---
+title: Zed
+---
+
+[Zed](https://zed.dev) is a new editor from the folks who made [Atom](https://atom-editor.cc/).
+It has a host of attractive features that align quite well with Harper's mission (including lighting-fast startup and responsiveness).
+
+The best part: thanks to the wonderful work of community contributors, Harper has support for it!
+To get started, follow the instructions over on the [Zed plugin's README](https://github.com/Stef16Robbe/harper_zed).
+Once installed, it will automatically download and run [`harper-ls`](/docs/integrations/language-server).
diff --git a/packages/web/vite.config.ts b/packages/web/vite.config.ts
index 623ee1605..41e42592f 100644
--- a/packages/web/vite.config.ts
+++ b/packages/web/vite.config.ts
@@ -37,12 +37,54 @@ export default defineConfig({
},
{
title: 'Integrations',
- to: '/docs/integrations'
+ to: '/docs/integrations',
+ items: [
+ {
+ title: 'Obsidian',
+ to: '/docs/integrations/obsidian'
+ },
+ {
+ title: 'Visual Studio Code',
+ to: '/docs/integrations/visual-studio-code'
+ },
+ {
+ title: 'Language Server',
+ to: '/docs/integrations/language-server'
+ },
+ {
+ title: 'Neovim',
+ to: '/docs/integrations/neovim'
+ },
+ {
+ title: 'Helix',
+ to: '/docs/integrations/helix'
+ },
+ {
+ title: 'Zed',
+ to: '/docs/integrations/zed'
+ },
+ {
+ title: 'Emacs',
+ to: '/docs/integrations/emacs'
+ }
+ ]
}
]
},
highlighter: {
- languages: ['svelte', 'sh', 'js', 'html', 'ts', 'md', 'css', 'scss', 'toml', 'rust']
+ languages: [
+ 'svelte',
+ 'sh',
+ 'js',
+ 'html',
+ 'ts',
+ 'md',
+ 'css',
+ 'scss',
+ 'toml',
+ 'rust',
+ 'lua'
+ ]
}
})
}),