MCPcopy Index your code
hub / github.com/ronreiter/interactive-tutorials / parseChunk

Method parseChunk

markdown/blockparser.py:63–75  ·  view source on GitHub ↗

Parse a chunk of markdown text and attach to given etree node. While the ``text`` argument is generally assumed to contain multiple blocks which will be split on blank lines, it could contain only one block. Generally, this method would be called by extensions when

(self, parent, text)

Source from the content-addressed store, hash-verified

61 return markdown.etree.ElementTree(self.root)
62
63 def parseChunk(self, parent, text):
64 """ Parse a chunk of markdown text and attach to given etree node.
65
66 While the ``text`` argument is generally assumed to contain multiple
67 blocks which will be split on blank lines, it could contain only one
68 block. Generally, this method would be called by extensions when
69 block parsing is required.
70
71 The ``parent`` etree Element passed in is altered in place.
72 Nothing is returned.
73
74 """
75 self.parseBlocks(parent, text.split('\n\n'))
76
77 def parseBlocks(self, parent, blocks):
78 """ Process blocks of markdown text and attach to given etree node.

Callers 4

parseDocumentMethod · 0.95
runMethod · 0.80
runMethod · 0.80
makeFootnotesDivMethod · 0.80

Calls 2

parseBlocksMethod · 0.95
splitMethod · 0.45

Tested by

no test coverage detected