TL;DR: We should migrate from reStructuredText (reST or rst) to Markedly Structured Text (MyST) and make myst_parser a hard dependency for building LLVM documentation with Sphinx.
If you’ve been on the internet in the last 10 years, you know that Markdown is the ubiquitous, default way to format plain text. reST has a deep, extensible feature set, but simplicity has won out. The most useful docs are the ones that exist, and are easy to update. Every IDE under the sun, such as VS Code, IntelliJ, NeoVim, etc, supports rendering Markdown dialects live in some way. reST has served us well, but I believe that now is the time set a long-term goal to migrate our docs to Markdown.
Since 2018 (D44910), LLVM has used a Markdown dialect called Markedly Structured Text (MyST) for portions of its documentation. Individual subprojects have effectively been free to choose between reST and MyST at their own discretion, and there has been no coherent policy about which is preferred.
Newer projects have tended to prefer markdown. MLIR is entirely Markdown, Flang is almost entirely Markdown, and LLDB is substantially Markdown. The LLVM and Clang docs are mainly in .rst files.
This has led to backporting the CIR docs to reST. The CIR docs were originally Markdown, but were converted back to reST format because it was still documented as the primary way to write LLVM docs. The point of this RFC is to declare affirmatively which format we prefer, update the Sphinx quickstart template to that effect, and make a full migration the desired end state.
Proposal
- MyST Markdown should become the preferred and eventual sole format for LLVM Sphinx documentation.
- New documentation should use
.mdunless there is a concrete blocker. - Existing
.rstfiles may continue to be edited until they are converted, but we should welcome mechanical conversion PRs. myst_parsershould become a hard dependency for Sphinx documentation builds, which appears to affect the man-page builder.- The Sphinx quickstart template should recommend Markdown for new docs. I’ll also update it with some migration tips, since I’ve started to dig into that.
I can commit to migrating a few key documents, but I can’t sign up to rewrite all reST documentation. I’m hoping that, in true open source fashion, volunteers will pitch in and help migrate their own docs and help review and approve mechanical conversion PRs. These are the docs I plan to migrate, in this order, one PR at a time:
- SphinxQuickstartTemplate: This is effectively our policy doc, so it goes first as an obvious demo of how to write new docs.
- LangRef: The most important doc. The edits must not reflow text needlessly to avoid conflicts with pending patches.
- DeveloperPolicy: Also an important doc.
- CMake: Next most important doc.
I’ve actually already prototyped the migration on GitHub in rnk:llvm-markdown, and I am serving up a copy of the generated documents temporarily here (starting with the quickstart), if you want to do a side-by-side comparison.