Skip to content

Commit

Permalink
Dump schema descriptions (#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimergp authored Nov 27, 2024
1 parent d8331a9 commit 55f9e18
Show file tree
Hide file tree
Showing 5 changed files with 908 additions and 335 deletions.
1 change: 1 addition & 0 deletions docs/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ dependencies:
- cffi=1.15.1
- charset-normalizer=2.1.1
- colorama=0.4.6
- commonmark=0.9.1
- cryptography=38.0.3
- docutils=0.19
- idna=3.4
Expand Down
20 changes: 20 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
# https://www.sphinx-doc.org/en/master/usage/configuration.html

import json
import os
from pathlib import Path

import commonmark

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

Expand Down Expand Up @@ -117,3 +120,20 @@
sitemap_locales = [None]
# We're hard-coding stable here since that's what we want Google to point to.
sitemap_url_scheme = "{link}"


# Custom hooks
os.environ["SPHINX_RUNNING"] = "1"


def docstring(app, what, name, obj, options, lines):
"""Transform MD to RST for autodoc"""
md = '\n'.join(lines)
ast = commonmark.Parser().parse(md)
rst = commonmark.ReStructuredTextRenderer().render(ast)
lines.clear()
lines += rst.splitlines()


def setup(app):
app.connect('autodoc-process-docstring', docstring)
Loading

0 comments on commit 55f9e18

Please sign in to comment.