[coreboot-gerrit] Change in coreboot[master]: Documentation: Fix markdown inline code

Philipp Deppenwiese (Code Review) gerrit at coreboot.org
Mon Oct 22 14:02:32 CEST 2018


Philipp Deppenwiese has submitted this change and it was merged. ( https://review.coreboot.org/29206 )

Change subject: Documentation: Fix markdown inline code
......................................................................

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 at das-labor.org>
Reviewed-on: https://review.coreboot.org/29206
Tested-by: build bot (Jenkins) <no-reply at coreboot.org>
Reviewed-by: Paul Menzel <paulepanter at users.sourceforge.net>
Reviewed-by: Jonathan Neuschäfer <j.neuschaefer at gmx.net>
Reviewed-by: Philipp Deppenwiese <zaolin.daisuki at gmail.com>
---
M Documentation/conf.py
1 file changed, 11 insertions(+), 5 deletions(-)

Approvals:
  build bot (Jenkins): Verified
  Paul Menzel: Looks good to me, but someone else must approve
  Philipp Deppenwiese: Looks good to me, approved
  Jonathan Neuschäfer: Looks good to me, but someone else must approve



diff --git a/Documentation/conf.py b/Documentation/conf.py
index 07868fa..85df9ea 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 @@
      '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 @@
 #
 # 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+

-- 
To view, visit https://review.coreboot.org/29206
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I0269d15a685ed0c0241be8c8acfade0e58363845
Gerrit-Change-Number: 29206
Gerrit-PatchSet: 2
Gerrit-Owner: Patrick Rudolph <siro at das-labor.org>
Gerrit-Reviewer: Angel Pons <th3fanbus at gmail.com>
Gerrit-Reviewer: Jonathan Neuschäfer <j.neuschaefer at gmx.net>
Gerrit-Reviewer: Patrick Georgi <pgeorgi at google.com>
Gerrit-Reviewer: Patrick Rudolph <siro at das-labor.org>
Gerrit-Reviewer: Paul Menzel <paulepanter at users.sourceforge.net>
Gerrit-Reviewer: Philipp Deppenwiese <zaolin.daisuki at gmail.com>
Gerrit-Reviewer: Tom Hiller <thrilleratplay at gmail.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply at coreboot.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20181022/d157e91d/attachment.html>


More information about the coreboot-gerrit mailing list