Parser¶
-
class
commonmark.blocks.
Parser
(options={})[source]¶ -
add_child
(tag, offset)[source]¶ Add block of type tag as a child of the tip. If the tip can’t accept children, close and finalize it and try its parent, and so on til we find a block that can accept children.
-
add_line
()[source]¶ Add a line to the block at the tip. We assume the tip can accept lines – that check should be done before calling this.
-
finalize
(block, line_number)[source]¶ Finalize a block. Close it and do any necessary postprocessing, e.g. creating string_content from strings, setting the ‘tight’ or ‘loose’ status of a list, and parsing the beginnings of paragraphs for reference definitions. Reset the tip to the parent of the closed block.
-