MCPcopy
hub / github.com/Python-Markdown/markdown / parseChunk

Method parseChunk

markdown/blockparser.py:120–136  ·  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: etree.Element, text: str)

Source from the content-addressed store, hash-verified

118 return etree.ElementTree(self.root)
119
120 def parseChunk(self, parent: etree.Element, text: str) -> None:
121 """ Parse a chunk of Markdown text and attach to given `etree` node.
122
123 While the `text` argument is generally assumed to contain multiple
124 blocks which will be split on blank lines, it could contain only one
125 block. Generally, this method would be called by extensions when
126 block parsing is required.
127
128 The `parent` `etree` Element passed in is altered in place.
129 Nothing is returned.
130
131 Arguments:
132 parent: The parent element.
133 text: The text to parse.
134
135 """
136 self.parseBlocks(parent, text.split('\n\n'))
137
138 def parseBlocks(self, parent: etree.Element, blocks: list[str]) -> None:
139 """ Process blocks of Markdown text and attach to given `etree` node.

Callers 6

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

Calls 1

parseBlocksMethod · 0.95

Tested by 1

testParseChunkMethod · 0.64