You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You need to add to myst_parser/mdit_to_docutils/base.py something like:
defrender_restructuredtext(self, token: SyntaxTreeNode) ->None:
"""Render the content of the token as restructuredtext."""# copy necessary elements (source, line no, env, reporter)newdoc=make_document()
newdoc["source"] =self.document["source"]
newdoc.settings=self.document.settingsnewdoc.reporter=self.reporter# pad the line numbers artificially so they offset with the fence blockpseudosource= ("\n"*token_line(token)) +token.content# actually parse the rst into our documentMockRSTParser().parse(pseudosource, newdoc)
# TODO the merging of documents below is a bit hacky, and needs to be improved# (ideally this would also be upstreamed to docutils/sphinx)fornodeinnewdoc:
ifnode["names"]:
self.document.note_explicit_target(node, node)
self.document.footnotes+=newdoc.footnotesforkey, _nodesinnewdoc.footnote_refs.items():
self.document.footnote_refs.setdefault(key, []).extend(_nodes)
for_nodein_nodes:
self.document.note_refname(_node)
self.document.symbol_footnotes+=newdoc.symbol_footnotesself.document.symbol_footnote_refs+=newdoc.symbol_footnote_refsself.document.autofootnotes+=newdoc.autofootnotesself.document.autofootnote_refs+=newdoc.autofootnote_refsself.current_node.extend(newdoc.children)
BUT still needs extra stuff to merge ids etc
The text was updated successfully, but these errors were encountered:
Ideally, the result of parsing with
eval-rst
would better merge with the parent document, i.e. ensuring all the "internal variables" are merged like: https://github.com/live-clones/docutils/blob/266f359408130ca25f6f161453140e73f169408a/docutils/docutils/nodes.py#L1799at the moment, if you add to
tests/test_sphinx/sourcedirs/footnotes/footnote_md.md
e.g.the footnotes will not be correctly recorded.
You need to add to
myst_parser/mdit_to_docutils/base.py
something like:BUT still needs extra stuff to merge ids etc
The text was updated successfully, but these errors were encountered: