[docs] commenting custom extensions

This commit is contained in:
Loïc Vital 2022-10-21 13:42:34 +02:00
parent e63b06a3b9
commit f3bed081bd
4 changed files with 39 additions and 3 deletions

View file

@ -1,7 +1,12 @@
# Utility functions for custom Sphinx extensions
from myst_parser.docutils_ import Parser
from myst_parser.mdit_to_docutils.base import make_document
# Given a string written in markdown
# parse its content
# and return the corresponding docutils document
def md_to_docutils(text):
parser = Parser()
doc = make_document(parser_cls=Parser)
@ -9,6 +14,9 @@ def md_to_docutils(text):
return doc
# Given a docutils node
# find an attribute that corresponds to a link (if it exists)
# and return its key
def get_link_key(node):
link_keys = ['uri', 'refuri', 'refname']
for key in link_keys: