Extension Configurationο
Install using pip:
pip install sphinx-readme
Add the extension to your conf.py:
extensions = [
"sphinx_readme",
]
For an example of the minimum required configuration,
please see the sample conf.py file
Mandatory conf.py valuesο
html_contextο
- html_contextο
A dictionary containing info about your repository (
html_context)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
- Type
Dict
html_baseurlο
- html_baseurlο
The base URL which points to the root of the HTML documentation (
html_baseurl)- Type
str
readme_src_filesο
- readme_src_filesο
An individual/list of
rstsource files to parse, or a dictionary of source files mapped to output filesImportant
Filepaths should be specified relative to the source directory and
output directory- Type
Union[str, List]
readme_docs_url_typeο
- readme_docs_url_typeο
The documentation source to link to when resolving
autodoccross-referencesMust be either
"code"or"html""code": usessphinx.ext.linkcodeto replace references with links to highlighted source code
- Example
"html": replaces references with links to HTML documentation entries
- Example
Note
If set to
code, non-external:attr:cross-references will not be replaced with linksInstead, theyβll be replaced with
inline literalsor left as isPlease see
readme_replace_attrsandreadme_inline_markup
Optional conf.py valuesο
readme_out_dirο
- readme_out_dirο
Specifies the path of the directory to save generated
rstfiles toThe value should be provided as either
An absolute path; or
A path relative to the source directory
- Type
Union[str, Path]
- Default
the root directory of your repository, via
get_repo_dir()
readme_replace_attrsο
- readme_replace_attrsο
Specifies if non-external attribute (
:attr:) cross-references should be replacedβ¦
If
True, the value ofreadme_docs_url_typedetermines how replacements are made:"html": references are replaced with a link to the corresponding documentation entry
- Example
:attr:`icon_map`would be replaced withicon_mapor icon_map, depending on the value ofreadme_inline_markup
"code": attributes are replaced with inline markup
- Example
:attr:`icon_map`would be replaced withicon_map
Note
External attribute cross-references are always replaced with links to documentation
- Type
bool
- Default
True
readme_inline_markupο
readme_raw_directiveο
- readme_raw_directiveο
Specifies if the
rawdirective is supported by the platform you intend to render the generated file onTip
GitHub supports the
rawdirectivePyPi, GitLab, and BitBucket do not support the
rawdirective
If set to
False,Admonitions will be replaced with the
list-tabledirective instead of HTML tablesAll
rawdirectives in the file will be removed
- Type
bool
- Default
True
readme_tagsο
- readme_tagsο
Specifies tags to use when evaluating the
<expression>argument ofonlydirectivesTip
See
replace_only_directives()for more detail- Type
List[str]
- Default
["readme"]
readme_include_directiveο
- readme_include_directiveο
Specifies if
includedirectives should be parsed (file content inserted) or removed- Type
bool
- Default
True
readme_admonition_iconsο
- readme_admonition_iconsο
An optional mapping of admonition classes and their icons
If specified, will be used to update the
icon_map(below)
- Type
Optional[Dict[str, str]]
- Default
{
'attention': 'ποΈ',
'caution': 'β οΈ',
'danger': 'β’',
'error': 'β',
'hint': 'π§ ',
'important': 'π’',
'note': 'π',
'tip': 'π‘',
'warning': 'π©',
'default': 'π'
}
readme_default_admonition_iconο
readme_rubric_headingο
- readme_rubric_headingο
The character to use when replacing
rubricdirectives with section headersMust be one of the following valid section title adornment characters:
! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~If not specified, rubrics will be replaced with bold text instead of a heading
- Type
str
- Default
bold inline markup (
**title**)
readme_blobο
- readme_blobο
The repository blob to link to - any of
"head","last_tag", or"{blob}""head": links to the most recent commit hash; if this commit is tagged, uses the tag instead"last_tag": links to the most recently tagged commit; if no tags exist, uses"head""{blob}": links to the specified blob, for example"master"or"v2.0.1"
- Type
str
- Default
"head"
linkcode_resolveο
- linkcode_resolveο
A
linkcode_resolve()function forsphinx.ext.linkcodeto use when resolving the target ofautodoccross-references- Type
Callable
- Default
return value of
get_linkcode_resolve()