Skip to content

Commit

Permalink
seventh work session; finish basic functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
trueberryless committed Jan 7, 2025
1 parent 709c6e6 commit 3db838a
Show file tree
Hide file tree
Showing 8 changed files with 650 additions and 109 deletions.
11 changes: 10 additions & 1 deletion docs/astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,16 @@ export default defineConfig({
label: "Deutsch",
},
},
plugins: [starlightSpellChecker()],
plugins: [
starlightSpellChecker({
usage: {
enabled: true,
},
spell: {
ignore: ["astro.config.mjs"],
},
}),
],
sidebar: [
{
label: "Start Here",
Expand Down
31 changes: 0 additions & 31 deletions docs/src/content/docs/de/test.mdx

This file was deleted.

2 changes: 1 addition & 1 deletion docs/src/content/docs/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Check your documentation for spelling mistakes; multilingual support.

## Prerequisites

You will need to have a Starlight websit set up.
You will need to have a Starlight website set up.
If you don't have one yet, you can follow the ["Getting Started"](https://starlight.astro.build/getting-started) guide in the Starlight docs to create one.

## Installation
Expand Down
14 changes: 10 additions & 4 deletions packages/starlight-spell-checker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import {
type StarlightSpellCheckerConfig,
type StarlightSpellCheckerUserConfig,
} from "./libs/config";
import { logErrors, validateTexts } from "./libs/validation";
import { logErrors, logWarnings, validateTexts } from "./libs/validation";
import { clearContentLayerCache } from "./libs/astro";
import { remarkStarlightSpellChecker } from "./libs/remark";
import { green } from "kleur/colors";

export { type StarlightSpellCheckerConfig };

Expand Down Expand Up @@ -42,17 +43,22 @@ export default function starlightSpellChecker(
});
},
"astro:build:done": async ({ dir, pages }) => {
const misspellings = await validateTexts(
const { warnings, errors } = await validateTexts(
pages,
dir,
astroConfig,
starlightConfig,
config
);

logErrors(logger, misspellings);
logWarnings(logger, warnings);
logErrors(logger, errors);

if (misspellings.size > 0) {
if (warnings.size <= 0 && errors.size <= 0) {
logger.info(green("✓ All words spelled correctly.\n"));
}

if (errors.size > 0) {
throwPluginError("Spelling validation failed.");
}
},
Expand Down
Loading

0 comments on commit 3db838a

Please sign in to comment.