having unified and well-readable documentation is an important aspect of providing the user of a Julia package to not only get started, but to also use the package throughout. For example there are the Google developer documentation style guide or the Microsoft Writing Style Guide.
In my own experience, these guides are only followed, if a developer (here: myself) is reminded often enough to follow them. I recently added a GitHub action to my Package repository to remember to update the Changelog before merging a PR.
I would like to present a short introduction on how to set up a check for the above style guides using the example of the Google set of rules for your Julia package documentation. This is inspired by the setup of JuMP.jl, where I personally stumbled into this.
After that, we can call
vale on terminal, which for example accepts a folder to check all files in.
vale for your documentation, create a
docs/.vale.ini in the
docs folder. Mine has the following content
StylesPath = styles MinAlertLevel = warning Vocab = Manopt Packages = Google [*.md] BasedOnStyles = Vale, Google TokenIgnores = \ \$.+?\$, \ \]\(@(ref|id|cite).+?\), \
The first two lines tell vale, that styles are stored in
docs/styles, and that we want to see already warnings and not only errors (but not suggestions).
Vocab = Manopt means that in the file
docs/styles/Vocab/Manopt/accept.txt we collect (one entry per line) words, especially names, that are not considered errors, mine for example contains
Manifolds.jl is considered a correct word, as well as
manopt both with M and m upfront, and with or without the suffixes .org and .jl – so regular expressions an also be used therein.
We also specify that we want to use the
$...$ and documenter style id/ref/cite entries.
With this setup, we can already call
vale sync (from within the
docs/ folder) for setup, which installs the
vale src checks its rules on the files in the
docs/src folder, which for us means all Markdown files.
Another possibility is to use the VS Code extension.
Finally, one can add a run of vale for example to the documenter run on CI, since vale also provides several GitHub actions. My
documenter.yml contains the step
- name: "vale.sh spell check" uses: errata-ai/vale-action@reviewdog with: files: docs/src fail_on_error: true filter_mode: nofilter vale_flags: "--config=docs/.vale.ini"
which besides running the same
vale src as above also does the
vale sync setup before, so there is no need to check in the automatically installed
styles like the
The start might take a while to work through ones own documentation and follow a style, but I for example learned to avoid
i.e. in documentations by now and to unify several styles, like capitalisation of headings even more.
addendum: For now it does not yet seem possible to check Julia code, especially doc-strings as well. But I will extend this post as soon as that is possible.