Skip to content

Commit

Permalink
Adds instructions for running Vale locally
Browse files Browse the repository at this point in the history
  • Loading branch information
dawnkelly09 committed Sep 26, 2024
1 parent 162bd64 commit 2715de4
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 6 deletions.
38 changes: 32 additions & 6 deletions .CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contribute to the Polkadot Developer Docs

The documentation source files are written in [Markdown](https://daringfireball.net/projects/markdown) and generally follow the [PaperMoon style guide](https://github.com/papermoonio/documentation-style-guide/blob/main/style-guide.md). If the PaperMoon style guide does not provide explicit guidance on a particular subject, please default to the [Google developer documentation style guide](https://developers.google.com/style).
The documentation source files are written in [Markdown](https://daringfireball.net/projects/markdown) and generally follow the [PaperMoon style guide](https://github.com/papermoonio/documentation-style-guide/blob/main/style-guide.md). If the PaperMoon style guide doesn't provide explicit guidance on a particular subject, please default to the [Google developer documentation style guide](https://developers.google.com/style).

This guide covers how to contribute to the documentation, including serving a local version of the site, adding new pages and directories, managing images and code snippets, and a few SEO tips.

Expand All @@ -18,6 +18,7 @@ This guide covers how to contribute to the documentation, including serving a lo
- [Adding Code and Text Snippets](#adding-code-and-text-snippets)
- [Adding Images](#adding-images)
- [Optimizing for SEO](#search-enging-optimization-seo)
- [Tools for Editing](#tools-for-editing)

## Viewing Site Locally

Expand All @@ -27,9 +28,9 @@ You may want to spin up a local version of the documentation site to preview you

Building and serving the site requires cloning two repositories:

- **[Polkadot MkDocs](https://github.com/papermoonio/polkadot-mkdocs)** - contains the MkDocs config files, theme overrides, and custom CSS for the Polkadot documentation site
- **[Polkadot MkDocs](https://github.com/papermoonio/polkadot-mkdocs)** - contains the MkDocs configuration files, theme overrides, and custom CSS for the Polkadot documentation site

- **[Polkadot Docs](https://github.com/polkadot-developers/polkadot-docs)** - the actual content is stored in the polkadot-docs repo and pulled into the polkadot-mkdocs directory during build
- **[Polkadot Docs](https://github.com/polkadot-developers/polkadot-docs)** - the actual content is stored in the `polkadot-docs` repository and pulled into the `polkadot-mkdocs` directory during build

For everything to work correctly, the file structure needs to be as follows:

Expand Down Expand Up @@ -65,7 +66,7 @@ To set up the structure, follow these steps:

This command will install all dependencies listed in the `requirements.txt` file.

2. In the polkadot-mkdocs folder (which should be the current one), you can build the site by running:
2. In the `polkadot-mkdocs` folder (which should be the current one), you can build the site by running:

```bash
mkdocs serve
Expand Down Expand Up @@ -127,7 +128,7 @@ If you are adding pages to an existing section, the steps are simplified. Howeve
- Add the new markdown page to the appropriate section. Note that the filename becomes part of the URL for this page. See the [style guide](https://github.com/papermoonio/documentation-style-guide/blob/main/style-guide.md#naming-conventions) for additional guidance on naming conventions.
- Ensure the new content page includes the following:
- **`title`** - represents the `<title>` tag and is used for SEO purposes (not displayed on the published site) Titles have a maximum length of 45 characters.
- **`description`** - represents the meta-description and is also used for SEO purposes (not displayed on the published site). Descriptions should be between 120-160 characters and should provide a preview into the page topic.
- **`description`** - represents the meta-description and is also used for SEO purposes (not displayed on the published site). Descriptions should be 120-160 characters and should provide a preview into the page topic.
- **Page title** - an H1 heading title to be displayed at the top of the page
- **`## Checking Prerequisites` section** - if the guide requires the user to have specific developer tools installed, for example, Docker or MetaMask, it should be listed here
Expand Down Expand Up @@ -168,7 +169,7 @@ More resources for [SEO Optimization](#search-engine-optimization-seo) of titles
3. Once you commit and push all of your changes, open a pull request for the new content branch against the `main` branch
4. Monitor notifications and pull requests for feedback from code owners. At least one approval is required before merging content
If your additions or modifications are limited to content on an existing page, there is no need to worry about the [`.pages`](#example-pages-file) or [`index.md`](#example-indexmd-file) files, as changes to page content do not affect these files.
If your additions or modifications are limited to content on an existing page, there is no need to worry about the [`.pages`](#example-pages-file) or [`index.md`](#example-indexmd-file) files, as changes to page content don't affect these files.

## Adding Code and Text Snippets

Expand Down Expand Up @@ -208,3 +209,28 @@ Here are some resources to help you create good titles and descriptions for SEO:
- [Google's recommendation on good descriptions](https://developers.google.com/search/docs/advanced/appearance/snippet?hl=en)

In general, titles should be between 50 and 60 characters and descriptions should be between 120 and 160 characters.

## Tools for Editing

There are a few tools you may find useful for proofreading and editing your contributions:

- **[Vale](https://vale.sh/)** - the `polkadot-mkdocs` repository contains configuration for Vale, an open source NLP-powered linter for text. The configuration is a work in progress with a growing custom dictionary tailored toward software engineering, blockchain, and Polkadot terms. Running Vale against your files locally can serve as a first round of feedback to speed up the review process.

To use Vale locally to screen your work:

1. Visit the Vale site and follow the [installation instructions](https://vale.sh/docs/vale-cli/installation/)
2. From the `polkadot-mkdocs` directory run the following in your terminal:

```bash
vale (INSERT_PATH_TO_FILE)
```

The output will look something like:

![Vale sample terminal output](images/contributing/vale-output-01.webp)

3. You can use CMD+click to open the file with the flagged items. This is especially helpful if you run Vale against a directory with multiple files

4. Each flag tells you the line and location of the flagged item, the level of the flag (error, warning, or suggestion), and a suggestion for how to resolve the flag

5. Once you have addressed the flagged items, and made edits as needed, you can complete the normal steps to commit your changes and open a pull request to review for merge
Binary file added images/contributing/vale-output-01.webp
Binary file not shown.

0 comments on commit 2715de4

Please sign in to comment.