MCPcopy Create free account
hub / github.com/Python-Markdown/markdown / reset

Method reset

markdown/core.py:265–290  ·  view source on GitHub ↗

Resets all state variables to prepare the parser instance for new input. Called once upon creation of a class instance. Should be called manually between calls to [`Markdown.convert`][markdown.Markdown.convert].

(self)

Source from the content-addressed store, hash-verified

263 return self
264
265 def reset(self) -> Markdown:
266 """
267 Resets all state variables to prepare the parser instance for new input.
268
269 Called once upon creation of a class instance. Should be called manually between calls
270 to [`Markdown.convert`][markdown.Markdown.convert].
271 """
272 self.htmlStash.reset()
273 self.references.clear()
274 # The source lines and parsed tree of the last document are released
275 # here rather than in `convert`: both have long been reachable from
276 # the instance (`md.lines`, `md.parser.root`), and third-party
277 # extensions may read them until parsing is done.
278 self.lines = []
279 self.parser.root = None
280
281 if self.delimiters is not None:
282 self.delimiters.reset()
283 if self.delimiters not in self.inlinePatterns:
284 self.delimiters = None
285
286 for extension in self.registeredExtensions:
287 if hasattr(extension, 'reset'):
288 extension.reset()
289
290 return self
291
292 def set_output_format(self, format: str) -> Markdown:
293 """

Callers 13

__init__Method · 0.95
test_abbr_resetMethod · 0.95
testTOCResetMethod · 0.95
test_remove_processorMethod · 0.95
runMethod · 0.45
runMethod · 0.45
runMethod · 0.45
testMetaDataResetMethod · 0.45
testResetMethod · 0.45
testResetMethod · 0.45
test_ancestorsMethod · 0.45

Calls

no outgoing calls

Tested by 9

test_abbr_resetMethod · 0.76
testTOCResetMethod · 0.76
test_remove_processorMethod · 0.76
testMetaDataResetMethod · 0.36
testResetMethod · 0.36
testResetMethod · 0.36
test_ancestorsMethod · 0.36
test_ancestors_tailMethod · 0.36