diff mbox

[v2,08/12] doc: allow .md with py3-sphinx

Message ID 20180519125239.89629-9-luc.vanoostenryck@gmail.com (mailing list archive)
State Mainlined, archived
Headers show

Commit Message

Luc Van Oostenryck May 19, 2018, 12:52 p.m. UTC
The current support for markdown source files is fine
for py2-sphinx but not for py3.

Fix it by checking python's version and add the reference
to the mardown parser module accordingly.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Documentation/conf.py | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/Documentation/conf.py b/Documentation/conf.py
index 86f1dc47e..abd496db1 100644
--- a/Documentation/conf.py
+++ b/Documentation/conf.py
@@ -31,9 +31,16 @@  import datetime
 extensions = [
 ]
 
-source_parsers = {
-   '.md': 'recommonmark.parser.CommonMarkParser',
-}
+# support .md with python2 & python3
+if sys.version_info[0] > 2:
+    from recommonmark.parser import CommonMarkParser
+    source_parsers = {
+        '.md': CommonMarkParser,
+    }
+else:
+    source_parsers = {
+        '.md': 'recommonmark.parser.CommonMarkParser',
+    }
 
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ['templates']