A command to "beautify" RST files
benoitbryon opened this issue · 2 comments
benoitbryon commented
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.
benoitbryon commented
Implementation may be a RST docutils writer: takes a docutils tree and renders it as "standardized" RST.
I don't know if there are RST constructs that we can't reproduce:
- it seems that docutils tree doesn't embed original sourcecode. We can't simply "go back to original RST".
- so maybe there are tree elements that could be implemented with several RST structures (i.e. ambiguity).
But, let's give it a try...
benoitbryon commented
Started implementation at https://github.com/benoitbryon/rst2rst