ReadTheDocs Plug-in
This is a DITA-OT Plug-in which creates a set of output files suitable to create
a ReadTheDocs
documentation project. The transform is an extension of the existing DITA-OT
markdown plug-in (org.lwdita
) and creates a well-formatted
mkdocs.yaml
file.
Examples
Additionally it is possible to use the plug-in to create a DITA <bookmap>
file from an existing mkdocs.yaml
file.
Limitations
It is assumed that the underlying markdown is well-formed and usable by DITA-OT - in other words every heading must be at most one level deeper that the previous heading. To ensure this, it is recommended to prettify the existing markdown using prettier and fix the markup levels using the DITA Validatorfix-dita transform.
In general, the structure of a ReadTheDocs project is more limited than a typical *.ditamap
,
for example, an index.md
summary file is should be found root
of the project - this is the equivalent of a <bookabstract>
.
For the readthedocs
transform, the opening topic of the
ditamap will be used as the index.md
if no <bookabstract>
is found. Also <chapter>
divisions should be given a <navtitle>
only and no @href
if they are to be recognized as such in the
ReadTheDocs navigation sidebar.
Install
org.lwdita
plug-in which
should be present in the base installation. It has no further external
dependencies, and can be installed from the command line.
Run the plug-in installation commands:
dita install https://github.com/jason-fox/fox.jason.readthedocs/archive/master.zip
The dita command line tool requires no additional configuration.
Usage
Creating a ReadtheDocs Project from DITA content
To create the files for a ReadtheDocs project, use the readthedocs
transform and set the --input parameter to point to a
*.ditamap
file:
dita --format readthedocs \
--input document.ditamap
Converting a ReadtheDocs Project into DITA content
To create the files for a DITA-OT project, use the mkdocs2dita
transform and set the --input parameter to point to an
mkdocs.yml
file:
dita --format mkdocs2dita \
--input mkdocs.yml
Parameter Reference
-
args.css - Specifies the name of a custom
.css
file. The css is added to themkdocs.yml
file asextra_css
-
args.csspath - Specifies the location of a copied
.css
file relative to the output directory. -
args.cssroot - Specifies the directory that contains the
custom
.css
file. -
args.readthedocs.theme - Specifies a
theme
to style the ReadTheDocs output (default: readthedocs) -
args.readthedocs.template - Specifies a template
mkdocs.yml
file to use - the template can hold additional readthedocs attributes which are not generated by the transform. -
args.readthedocs.use.pages - Specifies whether to use
pages
rather thannav
(default no)