summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Rudolph <siro@das-labor.org>2018-10-22 10:52:40 +0200
committerPhilipp Deppenwiese <zaolin.daisuki@gmail.com>2018-10-22 12:02:28 +0000
commit39315985e89e6ef3e7c01e697faf439280045157 (patch)
tree8cf31d477da9bb57940f918a3133c4469afa5745
parent718775803896ece301099228df14b003842e6e39 (diff)
downloadcoreboot-39315985e89e6ef3e7c01e697faf439280045157.tar.xz
Documentation: Fix markdown inline code
recommonmark doesn't know about inline code, while all other software generating documentation is able to handle it. Add support for inline code by adding a wrapper class around the recommonmark parser that converts code to docutils literal blocks. Fixes invisible inline code in current documentation. Change-Id: I0269d15a685ed0c0241be8c8acfade0e58363845 Signed-off-by: Patrick Rudolph <siro@das-labor.org> Reviewed-on: https://review.coreboot.org/29206 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net> Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com>
-rw-r--r--Documentation/conf.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/Documentation/conf.py b/Documentation/conf.py
index 07868faece..85df9ea51e 100644
--- a/Documentation/conf.py
+++ b/Documentation/conf.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
import subprocess
+from recommonmark.parser import CommonMarkParser
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
@@ -156,9 +157,14 @@ texinfo_documents = [
'Miscellaneous'),
]
-source_parsers = {
- '.md': 'recommonmark.parser.CommonMarkParser',
-}
+enable_auto_toc_tree = True
+
+class MyCommonMarkParser(CommonMarkParser):
+ # remove this hack once upsteam RecommonMark supports inline code
+ def visit_code(self, mdnode):
+ from docutils import nodes
+ n = nodes.literal(mdnode.literal, mdnode.literal)
+ self.current_node.append(n)
# Documents to append as an appendix to all manuals.
#
@@ -176,11 +182,11 @@ source_parsers = {
#
# texinfo_no_detailmenu = False
-enable_auto_toc_tree = True
-
def setup(app):
from recommonmark.transform import AutoStructify
+ app.add_source_parser('.md', MyCommonMarkParser)
+
app.add_config_value('recommonmark_config', {
'enable_auto_toc_tree': True,
'enable_auto_doc_ref': False, # broken in Sphinx 1.6+