-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: created page listing Harper's rules
- Loading branch information
1 parent
5f98d68
commit 6616712
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<script module lang="ts"> | ||
import { LocalLinter } from 'harper.js'; | ||
export const prerender = true; | ||
export const frontmatter = { | ||
title: 'Rules' | ||
}; | ||
let info: Record<string, string> = $state({}); | ||
let titles: Record<string, string> = $state({}); | ||
let linter = new LocalLinter(); | ||
linter.getLintDescriptions().then(async (v) => { | ||
info = v; | ||
for (let key of Object.keys(info)) { | ||
titles[key] = await makeTitleCase(key); | ||
console.log(key, titles[key]); | ||
} | ||
}); | ||
/** Make a snake case string title case. */ | ||
function makeTitleCase(snakeCase: string): Promise<string> { | ||
return linter.toTitleCase(snakeCase.replaceAll('_', ' ')); | ||
} | ||
</script> | ||
|
||
<p>This page is an incomplete list of the various grammatical rules Harper checks for.</p> | ||
|
||
{#each Object.entries(info) as [name, description]} | ||
<h2>{titles[name]}</h2> | ||
<p>{description}</p> | ||
<p>This rule is also often referred to as <code>{name}</code>.</p> | ||
{/each} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters