Bug 1411430 - Support markdown in Sphinx docs; r?gps
MozReview-Commit-ID: IdRuC4AFarq
--- 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: