Bug 1411430 - Support markdown in Sphinx docs; r?gps draft
authorMaja Frydrychowicz <mjzffr@gmail.com>
Mon, 23 Oct 2017 09:59:31 -0400
changeset 687234 0d06c181940ad6cc19bc693f63a3f3a0688aa1d3
parent 685608 a124f4901430f6db74cfc7fe3b07957a1c691b40
child 737604 efa6336b852bd213783feb94e508c8cd87579d7a
push id86444
push userbmo:mjzffr@gmail.com
push dateThu, 26 Oct 2017 23:57:48 +0000
reviewersgps
bugs1411430
milestone58.0a1
Bug 1411430 - Support markdown in Sphinx docs; r?gps MozReview-Commit-ID: IdRuC4AFarq
build/sparse-profiles/sphinx-docs
taskcluster/ci/source-test/doc.yml
tools/docs/conf.py
tools/docs/mach_commands.py
--- a/build/sparse-profiles/sphinx-docs
+++ b/build/sparse-profiles/sphinx-docs
@@ -1,16 +1,17 @@
 %include build/sparse-profiles/mach
 
 [include]
 # Code for generating docs.
 glob:tools/docs/**
 
 # Potential docs sources
 glob:**/*.rst
+glob:**/*.md
 
 # Python API docs.
 glob:**/*.py
 
 # moz.build files are read to discover location of docs.
 glob:**/moz.build
 
 # Read to set the version of the docs.
--- a/taskcluster/ci/source-test/doc.yml
+++ b/taskcluster/ci/source-test/doc.yml
@@ -18,16 +18,17 @@ generate:
         command: >
             cd /builds/worker/checkouts/gecko &&
             ./mach doc --outdir docs-out --no-open --archive
         sparse-profile: sphinx-docs
     when:
         files-changed:
             - '**/*.py'
             - '**/*.rst'
+            - '**/*.md'
             - 'tools/docs/**'
 
 upload:
     description: Generate and upload the Sphinx documentation
     platform: lint/opt
     treeherder:
         symbol: tc(DocUp)
         kind: test
--- a/tools/docs/conf.py
+++ b/tools/docs/conf.py
@@ -3,16 +3,18 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from __future__ import unicode_literals
 
 import os
 import re
 import sys
 
+from recommonmark.parser import CommonMarkParser
+
 from datetime import datetime
 
 # Set up Python environment to load build system packages.
 OUR_DIR = os.path.dirname(__file__)
 topsrcdir = os.path.normpath(os.path.join(OUR_DIR, '..', '..'))
 
 EXTRA_PATHS = (
     'layout/tools/reftest',
@@ -35,16 +37,20 @@ extensions = [
     'sphinx.ext.autodoc',
     'sphinx.ext.graphviz',
     'sphinx.ext.todo',
     'mozbuild.sphinx',
 ]
 
 templates_path = ['_templates']
 source_suffix = '.rst'
+source_suffix = ['.rst', '.md']
+source_parsers = {
+   '.md': CommonMarkParser,
+}
 master_doc = 'index'
 project = u'Mozilla Source Tree Docs'
 year = datetime.now().year
 
 # Grab the version from the source tree's milestone.
 # FUTURE Use Python API from bug 941299.
 with open(os.path.join(topsrcdir, 'config', 'milestone.txt'), 'rt') as fh:
     for line in fh:
--- a/tools/docs/mach_commands.py
+++ b/tools/docs/mach_commands.py
@@ -39,16 +39,17 @@ class Documentation(MachCommandBase):
                      help='Serve documentation on an HTTP server, '
                           'e.g. ":6666".')
     @CommandArgument('--upload', action='store_true',
                      help='Upload generated files to S3')
     def build_docs(self, what=None, format=None, outdir=None, auto_open=True,
                    http=None, archive=False, upload=False):
         self._activate_virtualenv()
         self.virtualenv_manager.install_pip_package('sphinx_rtd_theme==0.1.6')
+        self.virtualenv_manager.install_pip_package('recommonmark==0.4.0')
 
         import sphinx
         import webbrowser
         import moztreedocs
 
         if not outdir:
             outdir = os.path.join(self.topobjdir, 'docs')
         if not what: