documentation-style-guide-sphinx icon indicating copy to clipboard operation
documentation-style-guide-sphinx copied to clipboard

Write a "style checker" extension for sphinx

Open benoitbryon opened this issue 13 years ago • 1 comments

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.

benoitbryon avatar May 02 '12 09:05 benoitbryon

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-resolved event, because at this stage, we know that documents are valid RST files. If necessary to be plugged before, maybe doctree-read or source-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.

benoitbryon avatar Jun 07 '12 11:06 benoitbryon