‹›
markdown.postprocessors
¶
Post-processors run on the text of the entire document after is has been serialized into a string. Postprocessors should be used to work with the text just before output. Usually, they are used add back sections that were extracted in a preprocessor, fix up outgoing encodings, or wrap the whole document.
Classes:
-
Postprocessor
–Postprocessors are run after the ElementTree it converted back into text.
-
RawHtmlPostprocessor
–Restore raw html to the document.
-
AndSubstitutePostprocessor
–Restore valid entities
-
UnescapePostprocessor
–Restore escaped chars.
Functions:
-
build_postprocessors
–Build the default postprocessors for Markdown.
‹›
markdown.postprocessors.build_postprocessors(md: Markdown, **kwargs: Any) -> util.Registry[Postprocessor]
¶
Build the default postprocessors for Markdown.
Return a Registry
instance which contains the following collection of classes with their assigned names and priorities.
Class Instance | Name | Priority |
---|---|---|
RawHtmlPostprocessor |
raw_html |
30 |
AndSubstitutePostprocessor |
amp_substitute |
20 |
‹›
markdown.postprocessors.Postprocessor(md: Markdown | None = None)
¶
Bases: Processor
Postprocessors are run after the ElementTree it converted back into text.
Each Postprocessor implements a run
method that takes a pointer to a
text string, modifies it as necessary and returns a text string.
Postprocessors must extend Postprocessor
.
Methods:
-
run
–Subclasses of
Postprocessor
should implement arun
method, which
‹›
markdown.postprocessors.RawHtmlPostprocessor(md: Markdown | None = None)
¶
Bases: Postprocessor
Restore raw html to the document.
Methods:
-
run
–Iterate over html stash and restore html.
-
isblocklevel
–Check is block of HTML is block-level.
-
stash_to_string
–Convert a stashed object to a string.
‹›
markdown.postprocessors.UnescapePostprocessor(md: Markdown | None = None)
deprecated
¶
Bases: Postprocessor
Deprecated
This class is deprecated and will be removed in the future; use UnescapeTreeprocessor
instead.
Restore escaped chars.