Skip to content

Commit

Permalink
docs: Add more pages and clean up (#5607)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason3S committed May 11, 2024
1 parent 66eaf10 commit 90cbc62
Show file tree
Hide file tree
Showing 8 changed files with 125 additions and 95 deletions.
2 changes: 1 addition & 1 deletion packages/cspell/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ The maintainers of cspell and thousands of other packages are working with Tidel

## Installation

```sh
```sh npm2yarn
npm install -g cspell
```

Expand Down
21 changes: 21 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 4 additions & 16 deletions website/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,25 @@ This website is built using [Docusaurus](https://docusaurus.io/), a modern stati
### Installation

```
$ yarn
$ pnpm i
```

### Local Development

```
$ yarn start
$ pnpm start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ yarn build
$ pnpm build:site
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

Using SSH:

```
$ USE_SSH=true yarn deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
Deployment is handled by the [Deploy Website](../.github/workflows/deploy-website.yml) workflow.
120 changes: 63 additions & 57 deletions website/docs/getting-started.md → website/docs/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ sidebar_position: 1
sidebar_label: Getting Started
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Spell Checking

## Installation
Expand All @@ -27,6 +30,8 @@ cspell lint "src/**/*.js"
**Check everything**

```sh
cspell .
# or
cspell "**"
```

Expand All @@ -45,40 +50,41 @@ CSpell can use JSON, Yaml, and JavaScript files for configuration. It automatica

For now choose to use either JSON or Yaml. Below are examples of each that include a custom dictionary definition. Both of them are equivalent. If you have both, CSpell will look for the `.json` file first.

**`cspell.json`**

```json
{
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json",
"version": "0.2",
"dictionaryDefinitions": [
{
"name": "project-words",
"path": "./project-words.txt",
"addWords": true
}
],
"dictionaries": ["project-words"],
"ignorePaths": ["node_modules", "/project-words.txt"]
}
```

**`cspell.config.yaml`**

```yaml
---
$schema: https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json
version: '0.2'
dictionaryDefinitions:
- name: project-words
path: './project-words.txt'
addWords: true
dictionaries:
- project-words
ignorePaths:
- 'node_modules'
- '/project-words.txt'
```
<Tabs>
<TabItem value="json" label="cspell.json">
```json
{
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json",
"version": "0.2",
"dictionaryDefinitions": [
{
"name": "project-words",
"path": "./project-words.txt",
"addWords": true
}
],
"dictionaries": ["project-words"],
"ignorePaths": ["node_modules", "/project-words.txt"]
}
```
</TabItem>
<TabItem value="yaml" label="cspell.config.yaml">
```yaml
---
$schema: https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json
version: '0.2'
dictionaryDefinitions:
- name: project-words
path: './project-words.txt'
addWords: true
dictionaries:
- project-words
ignorePaths:
- 'node_modules'
- '/project-words.txt'
```
</TabItem>
</Tabs>

These configuration files do three things:

Expand All @@ -94,53 +100,53 @@ Steps:

1. Create the dictionary file

```sh
touch project-words.txt
```
```sh
touch project-words.txt
```

1. Choose a set of files to start with, like all Markdown files, `**/*.md` and run the spell checker.

```sh
cspell "**/*.md"
```
```sh
cspell "**/*.md"
```

1. Look for any directories that need to be ignored and add them to `ignorePaths`. Example:

- `"bin"` - to ignore any directory / file called `bin`.
- `"translations/**"` - to ignore all files under the `translations` directory.
- `"packages/*/dist"` - to ignore the `dist` directory in each _package_.
- `"bin"` - to ignore any directory / file called `bin`.
- `"translations/**"` - to ignore all files under the `translations` directory.
- `"packages/*/dist"` - to ignore the `dist` directory in each _package_.

Once you have finished identifying directories and files to be ignored, it is now time to add words to the custom dictionary.
Once you have finished identifying directories and files to be ignored, it is now time to add words to the custom dictionary.

1. Have CSpell populate it with the words from your project.

```sh
echo "# New Words" >> project-words.txt
cspell --words-only --unique "**/*.md" | sort --ignore-case >> project-words.txt
```
```sh
echo "# New Words" >> project-words.txt
cspell --words-only --unique "**/*.md" | sort --ignore-case >> project-words.txt
```

This will append all new issues to the end of `project-words.txt`
This will append all new issues to the end of `project-words.txt`

1. Review the words in `project-words.txt` to check for any actual misspellings and remove them (the spell checker already thinks they are wrong).

1. Fix spelling issues.

To show the issues and suggestions, use:
To show the issues and suggestions, use:

```sh
cspell --no-progress --show-suggestions --show-context "**/*.md"
```
```sh
cspell --no-progress --show-suggestions --show-context "**/*.md"
```

1. Repeat the process with the other file types you want to check.

## 3. Fine-tuning

The following resources can help you with fine-tuning your configurations:

- [Making words forbidden](./forbidden-words.md)
- [Defining Custom Dictionaries](./dictionaries/custom-dictionaries)
- [About Dictionaries](./dictionaries)
- [Understanding CSpell Globs](./globs.md)
- [Making words forbidden](./forbidden-words.md)
- [Defining Custom Dictionaries](./dictionaries/custom-dictionaries)
- [About Dictionaries](./dictionaries)
- [Understanding CSpell Globs](./globs.md)

# Help

Expand Down
24 changes: 5 additions & 19 deletions website/docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ CSpell requires Node JS to run. Most likely it is already install.
node -v
```

It should be greater than `14.x`.
It should be greater than `18.x`.

### Resources:

Expand All @@ -28,34 +28,20 @@ It should be greater than `14.x`.

## CSpell

### **NPM Global**

```sh
```sh npm2yarn
npm install -g cspell@latest
```

### **NPM Package**

```sh
npm install --save-dev cspell@latest
```

### **Yarn Package**

```sh
yarn add --dev cspell@latest
```

## Running CSpell

- ```sh
cspell "**"
cspell .
```
- ```sh
npx cspell "**"
npx cspell .
```
- ```sh
yarn cspell "**"
yarn cspell .
```

# See Also
Expand Down
27 changes: 26 additions & 1 deletion website/docusaurus.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { themes as prismThemes } from 'prism-react-renderer';
import type { Config } from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';
import npm2yarn from '@docusaurus/remark-plugin-npm2yarn';

const config: Config = {
title: 'CSpell',
Expand Down Expand Up @@ -47,6 +48,28 @@ const config: Config = {
fileExtension: '.md',
},
],
[
'docusaurus-plugin-typedoc',
{
id: 'api-cspell',
out: './docs/api/cspell',
entryPoints: ['../packages/cspell/src/app/index.ts'],
tsconfig: '../packages/cspell/tsconfig.esm.json',
// outputFileStrategy: 'modules',
fileExtension: '.md',
},
],
// [
// 'docusaurus-plugin-typedoc',
// {
// id: 'api-cspell-trie-lib',
// out: './docs/api/cspell-trie-lib',
// entryPoints: ['../packages/cspell-trie-lib/src/lib/index.ts'],
// tsconfig: '../packages/cspell-trie-lib/tsconfig.json',
// // outputFileStrategy: 'modules',
// fileExtension: '.md',
// },
// ],
],

// Even if you don't use internationalization, you can use this field to set
Expand All @@ -65,7 +88,8 @@ const config: Config = {
sidebarPath: './sidebars.ts',
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl: 'https://github.com/streetsidesoftware/cspell/blob/main/docs',
editUrl: 'https://github.com/streetsidesoftware/cspell/tree/main/website/docs',
remarkPlugins: [npm2yarn],
},
// blog: {
// showReadingTime: true,
Expand Down Expand Up @@ -154,6 +178,7 @@ const config: Config = {
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
additionalLanguages: ['json', 'json5', 'bash'],
},
} satisfies Preset.ThemeConfig,
};
Expand Down
3 changes: 2 additions & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"clean": "rm -rf ../docs/docsV2",
"clear": "docusaurus clear ../docs/docsV2",
"clear": "docusaurus clear ../docs/docsV2 && docusaurus clear",
"serve": "docusaurus serve --dir ../docs/docsV2",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
Expand All @@ -20,6 +20,7 @@
"dependencies": {
"@docusaurus/core": "3.3.2",
"@docusaurus/preset-classic": "3.3.2",
"@docusaurus/remark-plugin-npm2yarn": "^3.3.2",
"@mdx-js/react": "^3.0.1",
"clsx": "^2.1.1",
"prism-react-renderer": "^2.3.1",
Expand Down
3 changes: 3 additions & 0 deletions website/src/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,12 @@
background-color: #242526;
} */

/*
// Keep the logo for now, we can change it later with a different logo.
.navbar__logo {
display: none;
}
*/

h1.hero__title {
color: var(--ifm-color-primary);
Expand Down

0 comments on commit 90cbc62

Please sign in to comment.