[llvm] 29ea1b4 - [Sphinx] Support older recommonmark versions.

Jonas Devlieghere via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 29 09:48:43 PDT 2020


Author: Jonas Devlieghere
Date: 2020-06-29T09:48:34-07:00
New Revision: 29ea1b4baaa8b9ec5dbd25f91693e422c958db2d

URL: https://github.com/llvm/llvm-project/commit/29ea1b4baaa8b9ec5dbd25f91693e422c958db2d
DIFF: https://github.com/llvm/llvm-project/commit/29ea1b4baaa8b9ec5dbd25f91693e422c958db2d.diff

LOG: [Sphinx] Support older recommonmark versions.

The "new way" of enabling recommonmark is only supported in recommonmark
0.5 and later. Use the deprecated approach with versions of Sphinx that
still support it.

If I understand correctly there's no way to use older versions of
recommonmark (<0.5) with newer versions of Sphinx (>3.0) because the old
approach got removed.

Differential revision: https://reviews.llvm.org/D75284

Added: 
    

Modified: 
    llvm/docs/conf.py

Removed: 
    


################################################################################
diff  --git a/llvm/docs/conf.py b/llvm/docs/conf.py
index 13bbc826de86..948c61c2c0f9 100644
--- a/llvm/docs/conf.py
+++ b/llvm/docs/conf.py
@@ -26,7 +26,14 @@
 
 # Add any Sphinx extension module names here, as strings. They can be extensions
 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = ['sphinx.ext.intersphinx', 'sphinx.ext.todo', 'recommonmark']
+extensions = ['sphinx.ext.intersphinx', 'sphinx.ext.todo']
+
+import sphinx
+if sphinx.version_info >= (3, 0):
+  # This requires 0.5 or later.
+  extensions.append('recommonmark')
+else:
+  source_parsers = {'.md': 'recommonmark.parser.CommonMarkParser'}
 
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ['_templates']


        


More information about the llvm-commits mailing list