|
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) |
19 | 33 |
|
20 | 34 | sys.path.insert(0, os.path.abspath('../..'))
|
21 | 35 | # -- General configuration ----------------------------------------------------
|
22 | 36 |
|
23 |
| -source_parsers = { |
24 |
| - '.md': CommonMarkParser, |
25 |
| -} |
26 |
| - |
27 | 37 | source_suffix = ['.rst', '.md']
|
28 | 38 |
|
29 | 39 | # Add any Sphinx extension module names here, as strings. They can be
|
30 | 40 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
31 | 41 | extensions = [
|
| 42 | + 'sphinx_markdown_tables', |
| 43 | + 'recommonmark', |
32 | 44 | 'sphinx.ext.autodoc',
|
33 | 45 | #'sphinx.ext.intersphinx',
|
34 | 46 | ]
|
|
80 | 92 |
|
81 | 93 | # Example configuration for intersphinx: refer to the Python standard library.
|
82 | 94 | #intersphinx_mapping = {'http://docs.python.org/': None}
|
| 95 | +def setup(app): |
| 96 | + app.add_config_value('recommonmark_config', { |
| 97 | + 'auto_toc_tree_section': 'Contents', |
| 98 | + 'enable_eval_rst': True, |
| 99 | + }, True) |
| 100 | + app.add_transform(AutoStructify) |
| 101 | + |
0 commit comments