Skip to content

Commit 5dcbf02

Browse files
committed
Create equation nodes for formula tag
1 parent ed735e6 commit 5dcbf02

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

mkdoxy/xml_parser.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
Code,
77
Md,
88
MdBlockQuote,
9+
MdBlockEquation,
910
MdBold,
1011
MdCodeBlock,
1112
MdHeader,
1213
MdImage,
14+
MdInlineEquation,
1315
MdItalic,
1416
MdLink,
1517
MdList,
@@ -277,6 +279,12 @@ def paras(self, p: Element, italic: bool = False) -> [Md]:
277279

278280
elif item.tag == "emphasis":
279281
ret.append(MdItalic(self.paras(item)))
282+
elif item.tag == "formula":
283+
equation = item.text.strip("$ ")
284+
if len(p) == 1 and item.tail is None:
285+
ret.append(MdBlockEquation(equation))
286+
else:
287+
ret.append(MdInlineEquation(equation))
280288

281289
if item.tail:
282290
if italic:

0 commit comments

Comments
 (0)