A Sphinx extension to generate README.rst
files that render beautifully on GitHub, PyPi, GitLab, BitBucket
📚 What's Sphinx README? |
---|
|
With sphinx_readme
, there's no need to rewrite your README.rst
as a README.md
file
Files generated by sphinx_readme
have nearly identical appearance and functionality
as html
builds, including sphinx.ext.autodoc
cross-references!
sphinx_readme
adds support for the following sphinx
and docutils
directives and features:
sphinx.ext.autodoc
cross-references (:mod:
,:class:
,:meth:
,:func:
, and:attr:
)- Standard cross-reference roles (
:doc:
and:ref:
) - Generic and Specific Admonitions
- Only directives
- Toctrees
- Rubrics
- Images
Install using pip:
pip install sphinx-readme
Add the extension to your conf.py
:
extensions = [
'sphinx_readme',
]
Please see Extension Configuration for full documentation on configuration variables
html_context
A dictionary containing info about your repository (
html_context
)Type:
dict
- At minimum, the username and repository name must be specified
- Please see HTML Context Settings to determine the correct dictionary keys for your hosting platform
html_baseurl
The base URL which points to the root of the HTML documentation (
html_baseurl
)Type:
str
readme_src_files
An individual/list of
rst
source files to parse, or a dictionary of source files mapped to output filesType:
Union[str, List[str], Dict[str,str]]
📢 Important |
---|
Filepaths should be specified relative to the source directory
and |
readme_docs_url_type
The documentation source to link to when resolving
autodoc
cross-referencesType:
str
Must be either
"code"
or"html"
"code"
: usessphinx.ext.linkcode
to replace references with links to highlighted source codeExample:
parse_intersphinx_nodes()
"html"
: replaces references with links to HTML documentation entriesExample:
parse_intersphinx_nodes()
📝 Note |
---|
If set to
|
extensions = [
"sphinx_readme",
]
html_context = {
'display_github': True,
'github_user': 'TDKorn',
'github_repo': 'sphinx-readme',
}
html_baseurl = "https://sphinx-readme.readthedocs.io/en/latest"
readme_src_files = "README.rst"
readme_docs_url_type = "code"
📢 Important |
---|
For platforms that don't support the readme_raw_directive = False |
Full documentation can be found on ReadTheDocs