Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
feat: attempt doing things manually
Elijah Potter6252e762bc90
diff --git a/packages/web/package.json b/packages/web/package.jsonindex e390e915f..adcc581dc 100644--- a/packages/web/package.json+++ b/packages/web/package.json@@ -20,6 +20,7 @@"autoprefixer": "^10.4.16","flowbite": "^1.8.1","flowbite-svelte": "^0.44.18",+ "mdsvex": "^0.12.3","postcss": "^8.4.31","svelte": "^4.2.19","svelte-check": "^3.4.3",@@ -32,9 +33,10 @@},"type": "module","dependencies": {+ "harper.js": "link:../harper.js",+ "highlight.js": "^11.11.0","lodash-es": "^4.17.21","reveal.js": "^5.1.0",- "svelte-intersection-observer": "^1.0.0",- "harper.js": "link:../harper.js"+ "svelte-intersection-observer": "^1.0.0"}}diff --git a/packages/web/src/app.css b/packages/web/src/app.cssindex dd22ccb17..ff06cfce2 100644--- a/packages/web/src/app.css+++ b/packages/web/src/app.css@@ -4,20 +4,24 @@@layer base {h1 {- @apply text-5xl;+ @apply text-5xl pt-4;}h2 {- @apply text-3xl sm:text-3xl lg:text-4xl;+ @apply text-3xl sm:text-3xl lg:text-4xl pt-4;}p {- @apply lg:text-base md:text-xl xl:text-xl;+ @apply lg:text-base md:text-xl xl:text-xl pt-4;}* {@apply dark:text-white;}++ a {+ @apply underline;+ }}* {@@ -68,3 +72,7 @@ textarea {animation-timing-function: cubic-bezier(0, 0, 0.2, 1);}}++html {+ height: 100%;+}diff --git a/packages/web/src/app.html b/packages/web/src/app.htmlindex 29a96bd1c..dcfc3bd58 100644--- a/packages/web/src/app.html+++ b/packages/web/src/app.html@@ -1,25 +1,23 @@<!doctype html><html lang="en">- <head>- <meta charset="utf-8" />- <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />- <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />- <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />- <link rel="manifest" href="/site.webmanifest" />- <link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5" />- <meta name="msapplication-TileColor" content="#da532c" />- <meta name="theme-color" content="#ffffff" />- <meta name="viewport" content="width=device-width, initial-scale=1" />- <title>Write With Harper</title>- %sveltekit.head%- <script- data-goatcounter="https://harper.goatcounter.com/count"- async- src="//gc.zgo.at/count.js"- ></script>- </head>- <body data-sveltekit-preload-data="hover" class="m-0 p-0 w-full h-full dark:bg-gray-800">- <div style="display: contents" class="m-0 p-0">%sveltekit.body%</div>- </body>+<head>+ <meta charset="utf-8" />+ <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />+ <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />+ <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />+ <link rel="manifest" href="/site.webmanifest" />+ <link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5" />+ <meta name="msapplication-TileColor" content="#da532c" />+ <meta name="theme-color" content="#ffffff" />+ <meta name="viewport" content="width=device-width, initial-scale=1" />+ <title>Write With Harper</title>+ %sveltekit.head%+ <script data-goatcounter="https://harper.goatcounter.com/count" async src="//gc.zgo.at/count.js"></script>+</head>++<body data-sveltekit-preload-data="hover" class="m-0 p-0 w-full h-full dark:bg-gray-800">+ <div style="display: contents" class="m-0 p-0 h-full">%sveltekit.body%</div>+</body>+</html>diff --git a/packages/web/src/lib/GutterCenter.svelte b/packages/web/src/lib/GutterCenter.svelteindex 30c786a4e..eb3eb7ea5 100644--- a/packages/web/src/lib/GutterCenter.svelte+++ b/packages/web/src/lib/GutterCenter.svelte@@ -1,5 +1,5 @@-<div class="flex flex-row justify-center">- <div class="lg:w-[1024px] w-full">+<div class="flex flex-row justify-center h-full">+ <div class="lg:w-[1024px] w-full h-full"><slot /></div></div>diff --git a/packages/web/src/lib/NavCol.svelte b/packages/web/src/lib/NavCol.sveltenew file mode 100644index 000000000..1a67a481a--- /dev/null+++ b/packages/web/src/lib/NavCol.svelte@@ -0,0 +1,23 @@+<script lang="ts">+ import { page } from '$app/stores';++ export let pages: Record<string, string> = {};++ function leaf(url: string): string {+ return url.split('/').pop() || '/';+ }++ $: currentPage = leaf($page.url.pathname);+</script>++<div class="w-48 m-2 p-2 border-black dark:border-white border-t-2 border-l-2 h-full">+ {#each Object.entries(pages) as [href, title]}+ <a {href}>+ <div+ class={`transition-all hover:translate-x-2 ${currentPage == leaf(href) ? 'translate-x-1 font-bold' : ''}`}+ >+ {title}+ </div></a+ >+ {/each}+</div>diff --git a/packages/web/src/routes/+layout.svelte b/packages/web/src/routes/+layout.svelteindex 784bf1955..c0d7af565 100644--- a/packages/web/src/routes/+layout.svelte+++ b/packages/web/src/routes/+layout.svelte@@ -12,19 +12,29 @@href="https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:ital,wght@0,400;0,700;1,400;1,700&display=swap"rel="stylesheet"/>-<div class="h-16" />-<div class="absolute top-8 right-8"><DarkMode /></div>-<GutterCenter>- <slot />-</GutterCenter>+<link+ href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&display=swap"+ rel="stylesheet"+/>++<div class="flex flex-col h-full">+ <div class="basis-16 flex-none" />+ <div class="absolute top-8 right-8"><DarkMode /></div>++ <div class="flex-1">+ <GutterCenter>+ <slot />+ </GutterCenter>+ </div>-<div class="w-full flex flex-row justify-center">- <a href="https://automattic.com/">- <div class="flex items-center">- An- <div class="inline-block"><AutomatticLogo height="32px" width="140px" /></div>- {displayName}- </div>- </a>+ <div class="w-full flex flex-row justify-center">+ <a href="https://automattic.com/">+ <div class="flex items-center">+ An+ <div class="inline-block"><AutomatticLogo height="32px" width="140px" /></div>+ {displayName}+ </div>+ </a>+ </div></div>diff --git a/packages/web/src/routes/+page.svelte b/packages/web/src/routes/+page.svelteindex bd01a4c75..ab70984e7 100644--- a/packages/web/src/routes/+page.svelte+++ b/packages/web/src/routes/+page.svelte@@ -5,7 +5,6 @@import Section from '$lib/Section.svelte';import Logo from '$lib/Logo.svelte';import GitHubLogo from '$lib/GitHubLogo.svelte';- import { DarkMode } from 'flowbite-svelte';import ObsidianLogo from '$lib/ObsidianLogo.svelte';let width = window.innerWidth;@@ -17,9 +16,6 @@$: mobile = width < 640;</script>-<div class="h-16" />-<div class="absolute top-8 right-8"><DarkMode /></div>-<div class="w-full flex flex-col items-center"><Logo width="200px" /></div>@@ -82,18 +78,15 @@<span slot="title">Native Everywhere</span><span slot="subtitle">Harper is both available as a <a- class="underline"href="https://github.com/automattic/harper/tree/master/harper-ls">language server</a>, and through WebAssembly, so you can get fantastic grammar checking anywhere you work.<br /><br /> That said, we take extra care to make sure the- <a- class="underline"- href="https://marketplace.visualstudio.com/items?itemName=elijah-potter.harper"+ <a href="https://marketplace.visualstudio.com/items?itemName=elijah-potter.harper">Visual Studio Code</a>, Neovim,- <a class="underline" href="https://github.com/Stef16Robbe/harper_zed">Zed</a>+ <a href="https://github.com/Stef16Robbe/harper_zed">Zed</a>and- <a class="underline" href="/obsidian">Obsidian</a> integration is amazing.+ <a href="/obsidian">Obsidian</a> integration is amazing.</span><img@@ -119,6 +112,6 @@<span slot="title">Open Source</span><span slot="subtitle">Harper is completely open source under the Apache-2.0 license. <br /><br /> Come pay us a visit- on <a class="underline" href="https://github.com/automattic/harper">GitHub.</a>+ on <a href="https://github.com/automattic/harper">GitHub.</a></span></Section>diff --git a/packages/web/src/routes/docs/+layout.svelte b/packages/web/src/routes/docs/+layout.sveltenew file mode 100644index 000000000..104638f00--- /dev/null+++ b/packages/web/src/routes/docs/+layout.svelte@@ -0,0 +1,18 @@+<script lang="ts">+ import NavCol from '$lib/NavCol.svelte';+ import 'highlight.js/styles/github.min.css';++ let pages = {+ './about': 'What Is Harper?',+ './test2': 'Test2',+ './integrations': 'Integrations'+ };+</script>++<div class="flex flex-row h-full">+ <NavCol {pages} />++ <div class="p-4">+ <slot />+ </div>+</div>diff --git a/packages/web/src/routes/docs/about/+page.md b/packages/web/src/routes/docs/about/+page.mdnew file mode 100644index 000000000..8b4562c5e--- /dev/null+++ b/packages/web/src/routes/docs/about/+page.md@@ -0,0 +1,29 @@+---+title: What Is Harper?+---++# {title}++Harper is a grammar checker designed to run anywhere there's text (so really, anywhere).+Most Harper users are catching their mistakes in Neovim, [Obsidian](/obsidian), or Visual Studio Code.++<script>+ import Editor from "$lib/Editor.svelte"+</script>+++<div class="h-96 w-96">+ <Editor content={`You can try out a editor that uses\nHarper under-the-hood here.\n\nIt is rnning in your browser right now. \n\nNo server required!`}/>+</div>+++## How Does It Work?++Harper takes advantage of decades of natural language research analyze how exactly how your words come together.+If something is off, Harper lets you know.++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,diff --git a/packages/web/src/routes/docs/integrations/+page.md b/packages/web/src/routes/docs/integrations/+page.mdnew file mode 100644index 000000000..966e8e56e--- /dev/null+++ b/packages/web/src/routes/docs/integrations/+page.md@@ -0,0 +1,37 @@+---+title: Integrations+---++# {title}++## Obsidian++++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.+++++## 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/test2/+page.md b/packages/web/src/routes/docs/test2/+page.mdnew file mode 100644index 000000000..610cd99bd--- /dev/null+++ b/packages/web/src/routes/docs/test2/+page.md@@ -0,0 +1,8 @@+---+title: This is a second test+description: Just a test+---++# {title}++diff --git a/packages/web/svelte.config.js b/packages/web/svelte.config.jsindex fd9caae53..572483ace 100644--- a/packages/web/svelte.config.js+++ b/packages/web/svelte.config.js@@ -1,9 +1,24 @@import adapter from '@sveltejs/adapter-node';import { vitePreprocess } from '@sveltejs/kit/vite';+import { mdsvex, escapeSvelte } from 'mdsvex';+import hljs from 'highlight.js/lib/common';/** @type {import('@sveltejs/kit').Config} */const config = {- preprocess: vitePreprocess(),+ extensions: ['.svelte', '.md'],+ preprocess: [+ vitePreprocess(),+ mdsvex({+ extensions: ['.md'],+ smartypants: true,+ highlight: {+ highlighter: async (code, language = 'text') => {+ const html = escapeSvelte(hljs.highlight(code, { language }).value);+ return `{@html \` <code class="p-4 rounded w-full block">${html}</code>\` }`;+ }+ }+ })+ ],kit: {adapter: adapter({diff --git a/packages/yarn.lock b/packages/yarn.lockindex f45da8679..e250cf694 100644--- a/packages/yarn.lock+++ b/packages/yarn.lock@@ -1327,6 +1327,11 @@resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-4.0.5.tgz#cb6e2a691b70cb177c6e3ae9c1d2e8b2ea8cd304"integrity sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==+"@types/unist@^2.0.0", "@types/unist@^2.0.2", "@types/unist@^2.0.3":+ version "2.0.11"+ resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.11.tgz#11af57b127e32487774841f7a4e54eab166d03c4"+ integrity sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==+"@types/vscode@^1.89.0":version "1.91.0"resolved "https://registry.yarnpkg.com/@types/vscode/-/vscode-1.91.0.tgz#badaf9dfca14b08f1ad32fe197558d8d1702c3c9"@@ -3221,6 +3226,11 @@ headers-polyfill@^4.0.2:resolved "https://registry.yarnpkg.com/headers-polyfill/-/headers-polyfill-4.0.3.tgz#922a0155de30ecc1f785bcf04be77844ca95ad07"integrity sha512-IScLbePpkvO846sIwOtOTDjutRMWdXdJmXdMvk6gCBHxFO8d+QKOQedyZSxFTTFYRSmlgSTDtXqqq4pcenBXLQ==+highlight.js@^11.11.0:+ version "11.11.0"+ resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-11.11.0.tgz#91b15082ca8cdbe22424e0a000449d7d8a5c74c6"+ integrity sha512-6ErL7JlGu2CNFHyRQEuDogOyGPNiqcuWdt4iSSFUPyferNTGlNTPFqeV36Y/XwA4V/TJ8l0sxp6FTnxud/mf8g==+hosted-git-info@^4.0.2:version "4.1.0"resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-4.1.0.tgz#827b82867e9ff1c8d0c4d9d53880397d2c86d224"@@ -3785,6 +3795,16 @@ [email protected]:resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-2.0.30.tgz#ce4df6f80af6cfbe218ecd5c552ba13c4dfa08cc"integrity sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==+mdsvex@^0.12.3:+ version "0.12.3"+ resolved "https://registry.yarnpkg.com/mdsvex/-/mdsvex-0.12.3.tgz#859d9a4985659fb4258e9343a859cabdc16ae911"+ integrity sha512-C/uIJamjNo5PHHnR3JHqsBPoLcfUBpzRmAEB6FLMXI/s7XHOceswjDMKqSPEW2WHmYpKm0taZ3U20GSyhMridA==+ dependencies:+ "@types/unist" "^2.0.3"+ prism-svelte "^0.4.7"+ prismjs "^1.17.1"+ vfile-message "^2.0.4"+mdurl@^1.0.1:version "1.0.1"resolved "https://registry.yarnpkg.com/mdurl/-/mdurl-1.0.1.tgz#fe85b2ec75a59037f2adfec100fd6c601761152e"@@ -4425,6 +4445,16 @@ pretty-format@^27.0.2:ansi-styles "^5.0.0"react-is "^17.0.1"+prism-svelte@^0.4.7:+ version "0.4.7"+ resolved "https://registry.yarnpkg.com/prism-svelte/-/prism-svelte-0.4.7.tgz#fbc6709450b4e2ed660ddb82c3718817fc584cbe"+ integrity sha512-yABh19CYbM24V7aS7TuPYRNMqthxwbvx6FF/Rw920YbyBWO3tnyPIqRMgHuSVsLmuHkkBS1Akyof463FVdkeDQ==++prismjs@^1.17.1:+ version "1.29.0"+ resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.29.0.tgz#f113555a8fa9b57c35e637bba27509dcf802dd12"+ integrity sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q==+process-nextick-args@~2.0.0:version "2.0.1"resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2"@@ -5412,6 +5442,13 @@ undici@^6.19.5:resolved "https://registry.yarnpkg.com/undici/-/undici-6.19.8.tgz#002d7c8a28f8cc3a44ff33c3d4be4d85e15d40e1"integrity sha512-U8uCCl2x9TK3WANvmBavymRzxbfFYG+tAu+fgx3zxQy3qdagQqBLwJVrdyO1TBfUXvfKveMKJZhpvUYoOjM+4g==+unist-util-stringify-position@^2.0.0:+ version "2.0.3"+ resolved "https://registry.yarnpkg.com/unist-util-stringify-position/-/unist-util-stringify-position-2.0.3.tgz#cce3bfa1cdf85ba7375d1d5b17bdc4cada9bd9da"+ integrity sha512-3faScn5I+hy9VleOq/qNbAd6pAx7iH5jYBMS9I1HgQVijz/4mv5Bvw5iw1sC/90CODiKo81G/ps8AJrISn687g==+ dependencies:+ "@types/unist" "^2.0.2"+universalify@^0.1.0:version "0.1.2"resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66"@@ -5465,6 +5502,14 @@ uuid@^9.0.1:resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.1.tgz#e188d4c8853cc722220392c424cd637f32293f30"integrity sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==+vfile-message@^2.0.4:+ version "2.0.4"+ resolved "https://registry.yarnpkg.com/vfile-message/-/vfile-message-2.0.4.tgz#5b43b88171d409eae58477d13f23dd41d52c371a"+ integrity sha512-DjssxRGkMvifUOJre00juHoP9DPWuzjxKuMDrhNbk2TdaYYBNMStsNhEOt3idrtI12VQYM/1+iM0KOzXi4pxwQ==+ dependencies:+ "@types/unist" "^2.0.0"+ unist-util-stringify-position "^2.0.0"+version "2.1.8"resolved "https://registry.yarnpkg.com/vite-node/-/vite-node-2.1.8.tgz#9495ca17652f6f7f95ca7c4b568a235e0c8dbac5"