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

Method build_parser

markdown/core.py:131–157  ·  view source on GitHub ↗

Build the parser from the various parts. Assigns a value to each of the following attributes on the class instance: * **`Markdown.preprocessors`** ([`Registry`][markdown.util.Registry]) -- A collection of [`preprocessors`][markdown.preprocessors]. * **`Ma

(self)

Source from the content-addressed store, hash-verified

129 self.reset()
130
131 def build_parser(self) -> Markdown:
132 """
133 Build the parser from the various parts.
134
135 Assigns a value to each of the following attributes on the class instance:
136
137 * **`Markdown.preprocessors`** ([`Registry`][markdown.util.Registry]) -- A collection of
138 [`preprocessors`][markdown.preprocessors].
139 * **`Markdown.parser`** ([`BlockParser`][markdown.blockparser.BlockParser]) -- A collection of
140 [`blockprocessors`][markdown.blockprocessors].
141 * **`Markdown.inlinePatterns`** ([`Registry`][markdown.util.Registry]) -- A collection of
142 [`inlinepatterns`][markdown.inlinepatterns].
143 * **`Markdown.treeprocessors`** ([`Registry`][markdown.util.Registry]) -- A collection of
144 [`treeprocessors`][markdown.treeprocessors].
145 * **`Markdown.postprocessors`** ([`Registry`][markdown.util.Registry]) -- A collection of
146 [`postprocessors`][markdown.postprocessors].
147
148 This method could be redefined in a subclass to build a custom parser which is made up of a different
149 combination of processors and patterns.
150
151 """
152 self.preprocessors = build_preprocessors(self)
153 self.parser = build_block_parser(self)
154 self.inlinePatterns = build_inlinepatterns(self)
155 self.treeprocessors = build_treeprocessors(self)
156 self.postprocessors = build_postprocessors(self)
157 return self
158
159 def registerExtensions(
160 self,

Callers 1

__init__Method · 0.95

Calls 5

build_preprocessorsFunction · 0.85
build_block_parserFunction · 0.85
build_inlinepatternsFunction · 0.85
build_treeprocessorsFunction · 0.85
build_postprocessorsFunction · 0.85

Tested by

no test coverage detected