diff --git a/myst_parser/docutils_renderer.py b/myst_parser/docutils_renderer.py index 2749eaf1..666f336d 100644 --- a/myst_parser/docutils_renderer.py +++ b/myst_parser/docutils_renderer.py @@ -325,7 +325,7 @@ def renderInlineAsText(self, tokens: List[Token]) -> str: # ### render methods for commonmark tokens def render_paragraph_open(self, token: NestedTokens): - para = nodes.paragraph("") + para = nodes.paragraph(token.children[0].content if token.children else "") self.add_line_and_source_path(para, token) with self.current_node_context(para, append=True): self.render_children(token) @@ -449,7 +449,7 @@ def render_heading_open(self, token: NestedTokens): if self.is_section_level(level, self.current_node): self.current_node = cast(nodes.Element, self.current_node.parent) - title_node = nodes.title() + title_node = nodes.title(token.children[0].content if token.children else "") self.add_line_and_source_path(title_node, token) new_section = nodes.section() @@ -719,7 +719,9 @@ def render_table_row(self, token: Token): with self.current_node_context(row, append=True): for child in token.children or []: entry = nodes.entry() - para = nodes.paragraph("") + para = nodes.paragraph( + child.children[0].content if child.children else "" + ) style = child.attrGet("style") # i.e. the alignment when using e.g. :-- if style: entry["classes"].append(style) @@ -865,7 +867,9 @@ def render_dl_open(self, token: NestedTokens): item = nodes.definition_list_item() self.add_line_and_source_path(item, child) with self.current_node_context(item, append=True): - term = nodes.term() + term = nodes.term( + child.children[0].content if child.children else "" + ) self.add_line_and_source_path(term, child) with self.current_node_context(term, append=True): self.render_children(child) diff --git a/tests/test_sphinx/sourcedirs/gettext/conf.py b/tests/test_sphinx/sourcedirs/gettext/conf.py new file mode 100644 index 00000000..0dff9fe3 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/gettext/conf.py @@ -0,0 +1,4 @@ +extensions = ["myst_parser"] +exclude_patterns = ["_build"] +copyright = "2020, Executable Book Project" +myst_enable_extensions = ["deflist"] diff --git a/tests/test_sphinx/sourcedirs/gettext/index.md b/tests/test_sphinx/sourcedirs/gettext/index.md new file mode 100644 index 00000000..59bc4674 --- /dev/null +++ b/tests/test_sphinx/sourcedirs/gettext/index.md @@ -0,0 +1,42 @@ +# **bold** text 1 + +**bold** text 2 + +> **bold** text 3 + +```{eval-rst} +.. note:: + + **bold** text 4 +``` + +* **bold** text 5 + +1. **bold** text 6 + +**bold** text 7 +: **bold** text 8 + +| **bold** text 9 | +| ---------------- | +| **bold** text 10 | + +