MCPcopy Create free account
hub / github.com/awolverp/markupever / parse

Function parse

python/markupever/parser.py:123–144  ·  view source on GitHub ↗

Parses HTML or XML content and returns the parsed document tree. Args: content: The HTML or XML content to parse, either as a string or bytes. options: Parsing options that specify whether to parse as HTML or XML. Returns: A TreeDom object representing the pars

(
    content: typing.Union[str, bytes],
    options: typing.Union[
        _rustlib.HtmlOptions,
        _rustlib.XmlOptions,
        typing.Literal["html"],
        typing.Literal["xml"],
    ] = "html",
)

Source from the content-addressed store, hash-verified

121
122
123def parse(
124 content: typing.Union[str, bytes],
125 options: typing.Union[
126 _rustlib.HtmlOptions,
127 _rustlib.XmlOptions,
128 typing.Literal["html"],
129 typing.Literal["xml"],
130 ] = "html",
131) -> TreeDom:
132 """
133 Parses HTML or XML content and returns the parsed document tree.
134
135 Args:
136 content: The HTML or XML content to parse, either as a string or bytes.
137 options: Parsing options that specify whether to parse as HTML or XML.
138
139 Returns:
140 A TreeDom object representing the parsed document tree.
141 """
142 parser = Parser(options)
143 parser.process(content)
144 return parser.finish().into_dom()
145
146
147def parse_file(

Callers 1

newMethod · 0.85

Calls 4

processMethod · 0.95
finishMethod · 0.95
ParserClass · 0.70
into_domMethod · 0.45

Tested by

no test coverage detected