Skip to content

Commit 62db434

Browse files
[lldb] Enable support for Markdown documentation pages (#89716)
RST is powerful but usually too powerful for 90% of what we need it for. Markdown is easier to edit and can be previewed easily without building the entire website. This copies what llvm does already, making myst_parser optional if you only want man pages. Previously we had Markdown enabled in 8b95bd3 but that got reverted. That did this in a different way but I've gone with the standard llvm set this time. I intend the first Markdown pages to be the remote protocol extension docs, as they are not in any set format right now.
1 parent b933c84 commit 62db434

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

lldb/docs/conf.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
import sys, os, re, shutil
1414
from datetime import date
1515

16+
# Add path for llvm_slug module.
17+
sys.path.insert(0, os.path.abspath(os.path.join("..", "..", "llvm", "docs")))
18+
1619
building_man_page = tags.has("builder-man")
1720

1821
# For the website we need to setup the path to the generated LLDB module that
@@ -42,6 +45,23 @@
4245
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
4346
extensions = ["sphinx.ext.todo", "sphinx.ext.mathjax", "sphinx.ext.intersphinx"]
4447

48+
# When building man pages, we do not use the markdown pages,
49+
# So, we can continue without the myst_parser dependencies.
50+
# Doing so reduces dependencies of some packaged llvm distributions.
51+
try:
52+
import myst_parser
53+
54+
extensions.append("myst_parser")
55+
except ImportError:
56+
if not tags.has("builder-man"):
57+
raise
58+
59+
# Automatic anchors for markdown titles
60+
from llvm_slug import make_slug
61+
62+
myst_heading_anchors = 6
63+
myst_heading_slug_func = make_slug
64+
4565
autodoc_default_options = {"special-members": True}
4666

4767
# Unless we only generate the basic manpage we need the plugin for generating
@@ -69,6 +89,7 @@
6989
# The suffix of source filenames.
7090
source_suffix = {
7191
".rst": "restructuredtext",
92+
".md": "markdown",
7293
}
7394

7495
# The encoding of source files.

0 commit comments

Comments
 (0)