Editing Tools
-
Git
-
An editor to edit AsciiDoc
-
Java and/or TypeScript IDE (optional)
-
Vale linter (optional)
A Java or TypeScript IDE is needed if you need to edit code examples.
The Vale linter makes various language and style checks. GitHub runs Vale when you make a pull request in the Vaadin Docs repository, so you don’t necessarily need it, but running it locally shortens your feedback loop. Using Vale locally while writing makes this process more convenient. You can run Vale command-line and some editors have Vale integration.
Editors and IDEs
You can use any editor to edit AsciiDoc. However, some editors support code highlighting and limited integrated preview. For others, you need to use external preview.
Capability | GitHub | Atom | VS Code |
---|---|---|---|
Edit multiple files at once | – | ✓ | ✓ |
Vale integration | – | 🌟🌟 | 🌟🌟🌟 |
Java IDE | – | 🌟 | 🌟🌟 |
TypeScript IDE | – | 🌟🌟 | 🌟🌟🌟 |
You could also use an IDE such as Eclipse, IntelliJ IDEA, or NetBeans. They all have good support for Java development, but TypeScript and AsciiDoc support varies. They may or may not have a suitable plugin for their support.
Editing on GitHub
You can make small fixes to documentation in GitHub itself. It’s only recommended for small fixes, as the preview process is slow.
On any page of the vaadin.com/docs
documentation site, you can click on the button to edit the contents.
Editing and Previewing
-
Edit the page source
-
Preview your modifications using the Preview tab in the GitHub editor.
Edit on GitHubNote the limitations of the preview.
-
Give the file change a title (in the Propose file change section). Make it descriptive.
Revise commit title and description for pull requestYou can also give an extended description.
Click Propose file change
-
Review the change and click Create pull request
Edit on GitHub -
Revise the title of the commit for the pull request.
Revise commit title and description for pull requestYou can also give the extended description here. GitHub shows it in the discussion of the pull request.
See Submitting Documentation for more details about making a pull request at GitHub.
Limitations
While handy for small fixes, editing on GitHub has several limitations:
-
Style sheet for the documentation site isn’t applied and hence emphasis and other custom formatting isn’t shown in the preview
-
Conditional directives don’t work, because attributes aren’t defined, and hence text intended only for web isn’t shown at all in the preview
-
Macros don’t work, for example menu selection macros
-
Cross-references don’t point to correct paths in the preview
-
Some formatting is wrong due to differences in the AsciiDoc compiler used in GitHub
Hence, this method is only recommended for trivial fixes where you can be certain that the contribution doesn’t break any formatting.
Atom Editor
The Atom text editor has decent support for editing and previewing AsciiDoc files.
Installing and Configuring AsciiDoc Plug-Ins
-
You can install the Atom from the
atom.io
website or with a package manager in your operating system. -
Then, you need to install the AsciiDoc preview and highlighting plug-ins with the Atom Package Manager as follows:
$ apm install asciidoc-preview language-asciidoc
-
In the Atom preferences, for the AsciiDoc plugin, you need to have the following attributes enabled:
experimental web
-
Now, when editing an AsciiDoc file, press Ctrl+Shift+A to preview the file.
Limitations
While Atom is a nice editor to work with and previewing is quick, it has several limitations:
-
Style sheet for the documentation site isn’t applied and hence emphasis and other custom formatting isn’t shown in the preview
-
Some macros don’t work
-
Cross-references don’t point to correct paths in the preview
-
Some formatting is wrong due to differences in the AsciiDoc version used in the AsciiDoc plugin for Atom.
Hence, even if you do most editing work with Atom, you must preview by building the website.
Vale
Vale is a natural language linter that supports AsciiDoc, among other formats. Checks for many of the Vaadin style guidelines are included in the custom Vale rules. GitHub runs the checks automatically when you make a pull request for documentation.
See the Vale documentation for instructions on installing it on macOS, Windows, or Linux.
You can run it on command-line by giving one or more AsciiDoc files as parameters:
$ vale editing-tools.asciidoc
editing-tools.asciidoc
154:32 warning 'simply' is a weasel word. Vaadin.Weasel
✖ 0 errors, 1 warnings and 0 suggestions in 1 file.
A Vale integration plugin is available for at least Atom (atomic-vale) and VS Code (Vale + VS Code).
1D5FF345-19F2-4F7B-836F-DA92F3CCD3F6