[docs] minor code refactoring

This commit is contained in:
Loïc Vital 2022-10-13 12:12:26 +02:00
parent cec2c79d6a
commit 652113443d
4 changed files with 25 additions and 25 deletions

17
docs/source/_ext/utils.py Normal file
View file

@ -0,0 +1,17 @@
from myst_parser.docutils_ import Parser
from myst_parser.mdit_to_docutils.base import make_document
def md_to_docutils(text):
parser = Parser()
doc = make_document(parser_cls=Parser)
parser.parse(text, doc)
return doc
def get_link_key(node):
link_keys = ['uri', 'refuri', 'refname']
for key in link_keys:
if key in node.attributes.keys():
return key
return None