documentation-style-guide-sphinx
documentation-style-guide-sphinx copied to clipboard
Write a "style checker" extension for sphinx
Feature: validate documentation style
In order to validate documentation against style guide conventions
As a documentation writer
I want to run scripts that give me feedback about style conventions
Scenario: Get feedback on documentation build
Given a Sphinx documentation
And style_guide extension is installed and enabled
When I run sphinx-build
Then I get errors, warnings and notices related to style conventions.
A question is: where should we plug RST syntax verification?
- At http://sphinx.pocoo.org/ext/appapi.html#events, we see that candidate would be
doctree-resolvedevent, because at this stage, we know that documents are valid RST files. If necessary to be plugged before, maybedoctree-readorsource-read... - But, it seems that a doctree object doesn't contain the original sourcecode... It contains a reference to the RST document and line, but what about multiline RST constructs? It seems not so easy to get and analyse the original RST sourcecode. Additional parsing may be required.
- docutils' RST parser is a state machine. It reads a document line per line and updates states and break conditions (a change in indentation is an example of break condition). Can we plug in to add information about RST markup during parsing? I don't know by now...
Example of useful information could be : for titles (sections), a "is_overlined" boolean and a "overline_char". So that we can easily compare it to best practices.