|
13 | 13 | # limitations under the License.
|
14 | 14 |
|
15 | 15 | import os
|
| 16 | +import re |
| 17 | +import shutil |
16 | 18 | import sys
|
17 | 19 |
|
18 |
| -from recommonmark.parser import CommonMarkParser |
| 20 | +from recommonmark.transform import AutoStructify |
| 21 | + |
| 22 | +# Work around https://github.com/readthedocs/recommonmark/issues/152 |
| 23 | +new_readme = [] |
| 24 | + |
| 25 | +with open("../../README.md", "r") as r: |
| 26 | + lines = r.readlines() |
| 27 | + for l in lines: |
| 28 | + nl = re.sub("\[!\[[\w\s]+\]\(", "[ |
| 29 | + new_readme.append(nl) |
| 30 | + |
| 31 | +with open("README.md", "w") as n: |
| 32 | + n.writelines(new_readme) |
| 33 | + |
| 34 | +# apparently index.rst can't search for markdown not in the same directory |
| 35 | +shutil.copy("../../CONTRIBUTING.md", ".") |
19 | 36 |
|
20 | 37 | sys.path.insert(0, os.path.abspath('../..'))
|
21 | 38 | # -- General configuration ----------------------------------------------------
|
22 | 39 |
|
23 |
| -source_parsers = { |
24 |
| - '.md': CommonMarkParser, |
25 |
| -} |
26 |
| - |
27 | 40 | source_suffix = ['.rst', '.md']
|
28 | 41 |
|
29 | 42 | # Add any Sphinx extension module names here, as strings. They can be
|
30 | 43 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
31 | 44 | extensions = [
|
| 45 | + 'sphinx_markdown_tables', |
| 46 | + 'recommonmark', |
32 | 47 | 'sphinx.ext.autodoc',
|
33 | 48 | #'sphinx.ext.intersphinx',
|
34 | 49 | ]
|
|
80 | 95 |
|
81 | 96 | # Example configuration for intersphinx: refer to the Python standard library.
|
82 | 97 | #intersphinx_mapping = {'http://docs.python.org/': None}
|
| 98 | +def setup(app): |
| 99 | + app.add_config_value('recommonmark_config', { |
| 100 | + 'auto_toc_tree_section': 'Contents', |
| 101 | + 'enable_eval_rst': True, |
| 102 | + }, True) |
| 103 | + app.add_transform(AutoStructify) |
| 104 | + |
0 commit comments