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

Method build_parser

markdown/core.py:133–159  ·  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

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