This project is about coding standards for Sphinx-based documentations.
benoitbryon / documentation-style-guide-sphinx Goto Github PK
View Code? Open in Web Editor NEWCoding standards for Sphinx-based documentations
Coding standards for Sphinx-based documentations
This project is about coding standards for Sphinx-based documentations.
Add test which checks that README is built without warnings or errors.
Import documentation conventions from some projects.
Including from https://github.com/gabrielfalcao/lettuce/blob/master/docs/dev/documentation.rst
Create project structure:
https://github.com/benoitbryon/documentation-style-guide-sphinx/blob/d16779976b3769f8713572e8cfa9a04cb5a53a78/README.rst doesn't follows style guide conventions. It should.
In order to make sure that README can be converted to HTML, add a script to build README.rst to HTML.
Issues with 2 spaces:
toctree
directive doesn't work with 2 spaces but seems to work with 3 or 4 spaces.The following block is indented with 2 spaces.
.. code-block:: python
def some_intendation():
"""This comment is indented with 4 spaces."""
Python convention is to use 4 spaces. Since most Sphinx projects are about Python projects, Python code-blocks are a really common use case. So 4 space indentation may be useful for many users (most of them?).
Another common use case for code-blocks is sh or bash... 4 spaces doesn't hurt in that case.
Add test which checks that documentation build doesn't generate errors or warnings.
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.
See http://www.python.org/dev/peps/pep-0287/
Is there any RST-style convention in this PEP?
In the style guide, it says:
Some programs parse .rst
with rst2html
_, which cannot interpret some
Sphinx's directives such as code-block
. So readers using such programs
actually lose some content.
As an example, well known Github
_ platform uses rst2html
to render .rst
files in its repository browser. Not only you lose
content, you also lose features like links to lines.
This doesn't appear to be the case (any longer). I uploaded a test here:
https://github.com/ardalis/Docs/blob/master/docs/github-test.rst
And it renders just fine (images are broken, but that's because I didn't copy them - code blocks render just fine, and no content is lost). When editing the file, it opens in a plain text editor, showing all RST markup, so again there doesn't appear to be any risk of loss of content when using .rst extension files and Github.
Can you comment and/or update the style guide?
Thanks!
Steve
Proof of concept implementation could be:
Feature: script which applies style guide recommendations on existing RST files
In order to apply style guide conventions on existing RST files
As a documentation writer
I want to run a script which does most of the work automatically
Scenario: apply style guide recommendations on an existing RST file
Given a file named `example.txt`
And this file contains valid RST content
And the title of the document doesn't use `#` (sharp) character with overline
And other titles don't use `#` (sharp) character
When I run some `rst-beautify` script with `example.txt` as argument
Then the file is modified in place and the title of the document uses `#` (sharp) character with overline.
https://github.com/benoitbryon/documentation-style-guide-sphinx/blob/3c96a81bcd52ceb7d057f9bcf291c2148d9c736e/docs/style-guide.txt is getting quite long.
Split it into several smaller documents.
See
=> The standard is .txt. This convention is on docutils website!
=> Don't use Sphinx's default which is .rst!
There are some RST conventions in PEP 12.
Adopt some of them? or ask the PEP author to adoptt the conventions here?
See https://github.com/benoitbryon/documentation-best-practices/issues/3
In RST documents, if you use H2 just after H1 like this...
##########
Some title
##########
********
Subtitle
********
Here some text.
... then it means that there is no introduction text.
Should be:
##########
Some title
##########
This document illustrates usage of introduction text.
********
Subtitle
********
Here some text.
Rename it to something like "documentation-style-guide-sphinx"?
README contains important information such as:
Merge it in documentation, so that it appears on static builds (i.e. on ReadTheDocs service).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.