sdkagent

markdown API reference

182 public APIs from markdown (Python-Markdown/markdown) — 73 classes, 22 functions, 87 methods. Signatures extracted by static analysis of the actual source.

Repository: Python-Markdown/markdown

KindCount
Classes73
Functions22
Methods87

API list

funcmarkdown.__main__.run()
Run Markdown from the command line.
classmarkdown.blockparser.BlockParser
Parse Markdown blocks into an `ElementTree` object.
methodmarkdown.blockparser.BlockParser.parseBlocks(parent:etree.Element, blocks:list[str]) -> None
Process blocks of Markdown text and attach to given `etree` node.
methodmarkdown.blockparser.BlockParser.parseChunk(parent:etree.Element, text:str) -> None
Parse a chunk of Markdown text and attach to given `etree` node.
methodmarkdown.blockparser.BlockParser.parseDocument(lines:Iterable[str]) -> etree.ElementTree
Parse a Markdown document into an `ElementTree`.
classmarkdown.blockparser.State
Track the current and nested state of the parser.
methodmarkdown.blockparser.State.isstate(state:Any) -> bool
Test that top (current) level is of given state.
methodmarkdown.blockparser.State.reset() -> None
Step back one step in nested state.
methodmarkdown.blockparser.State.set(state:Any)
Set a new state.
classmarkdown.blockprocessors.BlockProcessor
Base class for block processors.
methodmarkdown.blockprocessors.BlockProcessor.lastChild(parent:etree.Element) -> etree.Element | None
Return the last child of an `etree` element.
methodmarkdown.blockprocessors.BlockProcessor.looseDetab(text:str, level:int=1) -> str
Remove a tab from front of lines but allowing dedented lines.
methodmarkdown.blockprocessors.BlockProcessor.run(parent:etree.Element, blocks:list[str]) -> bool | None
Run processor.
methodmarkdown.blockprocessors.BlockProcessor.test(parent:etree.Element, block:str) -> bool
Test for block type.
classmarkdown.blockprocessors.BlockQuoteProcessor
Process blockquotes.
methodmarkdown.blockprocessors.BlockQuoteProcessor.clean(line:str) -> str
Remove `>` from beginning of a line.
classmarkdown.blockprocessors.CodeBlockProcessor
Process code blocks.
classmarkdown.blockprocessors.HRProcessor
Process Horizontal Rules.
classmarkdown.blockprocessors.HashHeaderProcessor
Process Hash Headers.
classmarkdown.blockprocessors.ListIndentProcessor
Process children of list items.
methodmarkdown.blockprocessors.ListIndentProcessor.get_level(parent:etree.Element, block:str) -> tuple[int, etree.Element]
Get level of indentation based on list level.
classmarkdown.blockprocessors.OListProcessor
Process ordered list blocks.
methodmarkdown.blockprocessors.OListProcessor.get_items(block:str) -> list[str]
Break a block into list items.
classmarkdown.blockprocessors.ParagraphProcessor
Process Paragraph blocks.
classmarkdown.blockprocessors.ReferenceProcessor
Process link references.
classmarkdown.blockprocessors.SetextHeaderProcessor
Process Setext-style Headers.
classmarkdown.blockprocessors.UListProcessor
Process unordered list blocks.
funcmarkdown.blockprocessors.build_block_parser(md:Markdown, **kwargs:Any) -> BlockParser
Build the default block parser used by Markdown.
classmarkdown.core.Markdown
A parser which converts Markdown to HTML.
methodmarkdown.core.Markdown.build_parser() -> Markdown
Build the parser from the various parts.
methodmarkdown.core.Markdown.convert(source:str) -> str
Convert a Markdown string to a string in the specified output format.
methodmarkdown.core.Markdown.is_block_level(tag:Any) -> bool
Check if the given `tag` is a block level HTML tag.
methodmarkdown.core.Markdown.registerExtension(extension:Extension) -> Markdown
Register an extension as having a resettable state.
methodmarkdown.core.Markdown.set_output_format(format:str) -> Markdown
Set the output format for the class instance.
funcmarkdown.core.markdown(text:str, **kwargs:Any) -> str
Convert a markdown string to HTML and return HTML as a Unicode string.
classmarkdown.extensions.Extension
Base class for extensions to subclass.
methodmarkdown.extensions.Extension.getConfig(key:str, default:Any='') -> Any
Return a single configuration option value.
methodmarkdown.extensions.Extension.getConfigs() -> dict[str, Any]
Return all configuration options.
methodmarkdown.extensions.Extension.setConfig(key:str, value:Any) -> None
Set a configuration option.
classmarkdown.extensions.abbr.AbbrBlockprocessor
Parse text for abbreviation references.
classmarkdown.extensions.abbr.AbbrExtension
Abbreviation Extension for Python-Markdown.
methodmarkdown.extensions.abbr.AbbrExtension.extendMarkdown(md)
Register the processors.
methodmarkdown.extensions.abbr.AbbrExtension.load_glossary(dictionary:dict[str, str])
Adds `dictionary` to our glossary.
classmarkdown.extensions.abbr.AbbrInlineProcessor
Abbreviation inline pattern.
classmarkdown.extensions.abbr.AbbrTreeprocessor
Replace abbreviation text with `<abbr>` elements.
methodmarkdown.extensions.abbr.AbbrTreeprocessor.create_element(title:str, text:str, tail:str) -> etree.Element
Create an `abbr` element.
methodmarkdown.extensions.abbr.AbbrTreeprocessor.run(root:etree.Element) -> etree.Element | None
Step through tree to find known abbreviations.
classmarkdown.extensions.admonition.AdmonitionExtension
Admonition extension for Python-Markdown.
methodmarkdown.extensions.admonition.AdmonitionExtension.extendMarkdown(md)
Register the processor.
classmarkdown.extensions.attr_list.AttrListExtension
Attribute List extension for Python-Markdown
methodmarkdown.extensions.attr_list.AttrListExtension.extendMarkdown(md)
Register the processor.
funcmarkdown.extensions.attr_list.get_attrs(str:str) -> list[tuple[str, str]]
Soft-deprecated.
methodmarkdown.extensions.codehilite.CodeHiliteExtension.extendMarkdown(md)
Register the processor.
classmarkdown.extensions.codehilite.HiliteTreeprocessor
Highlight source code in code blocks.
methodmarkdown.extensions.codehilite.HiliteTreeprocessor.code_unescape(text:str) -> str
Unescape code.
methodmarkdown.extensions.codehilite.HiliteTreeprocessor.run(root:etree.Element) -> None
Find code blocks and store in `htmlStash`.
funcmarkdown.extensions.codehilite.parse_hl_lines(expr:str) -> list[int]
Support our syntax for emphasizing certain lines of code.
classmarkdown.extensions.def_list.DefListExtension
Add definition lists to Markdown.
methodmarkdown.extensions.def_list.DefListExtension.extendMarkdown(md)
Register the processors.
classmarkdown.extensions.def_list.DefListIndentProcessor
Process indented children of definition list items.
classmarkdown.extensions.def_list.DefListProcessor
Process Definition Lists.
classmarkdown.extensions.extra.ExtraExtension
Add various extensions to Markdown class.
methodmarkdown.extensions.extra.ExtraExtension.extendMarkdown(md)
Register extension instances.
classmarkdown.extensions.fenced_code.FencedBlockPreprocessor
Find and extract fenced code blocks.
methodmarkdown.extensions.fenced_code.FencedBlockPreprocessor.run(lines:list[str]) -> list[str]
Match and store Fenced Code Blocks in the `HtmlStash`.
classmarkdown.extensions.footnotes.FootnoteBlockProcessor
Find footnote definitions and store for later use.
methodmarkdown.extensions.footnotes.FootnoteBlockProcessor.detab(block:str) -> str
Remove one level of indent from a block.
methodmarkdown.extensions.footnotes.FootnoteBlockProcessor.run(parent:etree.Element, blocks:list[str]) -> bool
Find, set, and remove footnote definitions.
classmarkdown.extensions.footnotes.FootnoteExtension
Footnote Extension.
methodmarkdown.extensions.footnotes.FootnoteExtension.addFootnoteRef(id:str) -> None
Store a footnote reference id in order of appearance.
methodmarkdown.extensions.footnotes.FootnoteExtension.extendMarkdown(md)
Register the processors.
methodmarkdown.extensions.footnotes.FootnoteExtension.get_separator() -> str
Get the footnote separator.
methodmarkdown.extensions.footnotes.FootnoteExtension.makeFootnoteId(id:str) -> str
Return footnote link id.
methodmarkdown.extensions.footnotes.FootnoteExtension.makeFootnoteRefId(id:str, found:bool=False) -> str
Return footnote back-link id.
methodmarkdown.extensions.footnotes.FootnoteExtension.makeFootnotesDiv(root:etree.Element) -> etree.Element | None
Return `div` of footnotes as `etree` Element.
methodmarkdown.extensions.footnotes.FootnoteExtension.setFootnote(id:str, text:str) -> None
Store a footnote for later retrieval.
methodmarkdown.extensions.footnotes.FootnoteExtension.unique_ref(reference:str, found:bool=False) -> str
Get a unique reference if there are duplicates.
classmarkdown.extensions.footnotes.FootnotePostTreeprocessor
Amend footnote div with duplicates.
methodmarkdown.extensions.footnotes.FootnotePostTreeprocessor.get_num_duplicates(li:etree.Element) -> int
Get the number of duplicate refs of the footnote.
classmarkdown.extensions.footnotes.FootnotePostprocessor
Replace placeholders with html entities.
classmarkdown.extensions.footnotes.FootnoteReorderingProcessor
Reorder list items in the footnotes div.
classmarkdown.extensions.footnotes.FootnoteTreeprocessor
Build and append footnote div to end of document.
classmarkdown.extensions.legacy_em.LegacyEmExtension
Add legacy_em extension to Markdown class.
methodmarkdown.extensions.legacy_em.LegacyEmExtension.extendMarkdown(md)
Register the processor.
classmarkdown.extensions.md_in_html.MarkdownInHtmlExtension
Add Markdown parsing in HTML to Markdown class.
methodmarkdown.extensions.md_in_html.MarkdownInHtmlExtension.extendMarkdown(md)
Register the processors.
classmarkdown.extensions.meta.MetaExtension
Meta-Data extension for Python-Markdown.
methodmarkdown.extensions.meta.MetaExtension.extendMarkdown(md)
Register the processor.
classmarkdown.extensions.meta.MetaPreprocessor
Get Meta-Data.
methodmarkdown.extensions.meta.MetaPreprocessor.run(lines:list[str]) -> list[str]
Parse Meta-Data and store in Markdown.Meta.
classmarkdown.extensions.nl2br.Nl2BrExtension
Newline-to-break extension for Python-Markdown.
methodmarkdown.extensions.nl2br.Nl2BrExtension.extendMarkdown(md)
Register the processor.
classmarkdown.extensions.sane_lists.SaneListExtension
Add sane lists to Markdown.
methodmarkdown.extensions.sane_lists.SaneListExtension.extendMarkdown(md)
Register the processors.
classmarkdown.extensions.sane_lists.SaneUListProcessor
Override `SIBLING_TAGS` to not include `ol`.
classmarkdown.extensions.smarty.SmartyExtension
Add Smarty to Markdown.
methodmarkdown.extensions.smarty.SmartyExtension.extendMarkdown(md)
Register the processors.
classmarkdown.extensions.tables.TableExtension
Add tables to Markdown.
methodmarkdown.extensions.tables.TableExtension.extendMarkdown(md)
Register the processor.
classmarkdown.extensions.tables.TableProcessor
Process Tables.
methodmarkdown.extensions.tables.TableProcessor.run(parent:etree.Element, blocks:list[str]) -> None
Parse a table block and build table.
classmarkdown.extensions.toc.TocExtension
Table of Contents Extension to Python-Markdown.
methodmarkdown.extensions.toc.TocExtension.extendMarkdown(md)
Register the processor.
classmarkdown.extensions.toc.TocTreeprocessor
Step through document and build TOC.
methodmarkdown.extensions.toc.TocTreeprocessor.build_toc_div(toc_list:list) -> etree.Element
Return a string div given a toc list.
methodmarkdown.extensions.toc.TocTreeprocessor.replace_marker(root:etree.Element, elem:etree.Element) -> None
Replace marker with elem.
methodmarkdown.extensions.toc.TocTreeprocessor.set_level(elem:etree.Element) -> None
Adjust header level according to base level.
funcmarkdown.extensions.toc.escape_cdata(text:str) -> str
Escape character data.
funcmarkdown.extensions.toc.get_name(el:etree.Element) -> str
Get title name.
funcmarkdown.extensions.toc.render_inner_html(el:etree.Element, md:Markdown) -> str
Fully render inner html of an `etree` element as a string.
funcmarkdown.extensions.toc.run_postprocessors(text:str, md:Markdown) -> str
Run postprocessors from Markdown instance on text.
funcmarkdown.extensions.toc.slugify(value:str, separator:str, unicode:bool=False) -> str
Slugify a string, to make it URL friendly.
funcmarkdown.extensions.toc.strip_tags(text:str) -> str
Strip HTML tags and return plain text.
funcmarkdown.extensions.toc.unescape(text:str) -> str
Unescape Markdown backslash escaped text.
funcmarkdown.extensions.toc.unique(id:str, ids:MutableSet[str]) -> str
Ensure id is unique in set of ids.
classmarkdown.extensions.wikilinks.WikiLinkExtension
Add inline processor to Markdown.
methodmarkdown.extensions.wikilinks.WikiLinkExtension.extendMarkdown(md)
Register the processor.
classmarkdown.extensions.wikilinks.WikiLinksInlineProcessor
Build link from `wikilink`.
funcmarkdown.extensions.wikilinks.build_url(label:str, base:str, end:str) -> str
Build a URL from the label, a base, and an end.
classmarkdown.htmlparser.HTMLExtractor
Extract raw HTML from text.
methodmarkdown.htmlparser.HTMLExtractor.at_line_start() -> bool
Returns True if current position is at start of line.
methodmarkdown.htmlparser.HTMLExtractor.close()
Handle any buffered data.
methodmarkdown.htmlparser.HTMLExtractor.get_endtag_text(tag:str) -> str
Returns the text of the end tag.
methodmarkdown.htmlparser.HTMLExtractor.get_starttag_text() -> str
Return full source of start tag: `<...>`.
methodmarkdown.htmlparser.HTMLExtractor.handle_empty_tag(data:str, is_block:bool)
Handle empty tags (`<data>`).
methodmarkdown.htmlparser.HTMLExtractor.reset()
Reset this instance.
methodmarkdown.inlinepatterns.AsteriskProcessor.build_double(m:re.Match[str], tags:str, idx:int) -> etree.Element
Return double tag.
methodmarkdown.inlinepatterns.AsteriskProcessor.build_element(m:re.Match[str], builder:str, tags:str, index:int) -> etree.Element
Element builder.
methodmarkdown.inlinepatterns.AsteriskProcessor.build_single(m:re.Match[str], tag:str, idx:int) -> etree.Element
Return single tag.
methodmarkdown.inlinepatterns.AsteriskProcessor.handleMatch(m:re.Match[str], data:str) -> tuple[etree.Element | None, int | None, int | None]
Parse patterns.
methodmarkdown.inlinepatterns.AsteriskProcessor.parse_sub_patterns(data:str, parent:etree.Element, last:etree.Element | None, idx:int) -> None
Parses sub patterns.
classmarkdown.inlinepatterns.EmStrongItem
Emphasis/strong pattern item.
classmarkdown.inlinepatterns.EscapeInlineProcessor
Return an escaped character.
classmarkdown.inlinepatterns.HtmlInlineProcessor
Store raw inline html and return a placeholder.
methodmarkdown.inlinepatterns.HtmlInlineProcessor.unescape(text:str) -> str
Return unescaped text given text with an inline placeholder.
classmarkdown.inlinepatterns.ImageInlineProcessor
Return a `img` element from the given match.
classmarkdown.inlinepatterns.ImageReferenceInlineProcessor
Match to a stored reference and return `img` element.
classmarkdown.inlinepatterns.InlineProcessor
Base class that inline processors subclass.
classmarkdown.inlinepatterns.LinkInlineProcessor
Return a link element from the given match.
classmarkdown.inlinepatterns.Pattern
Base class that inline patterns subclass.
methodmarkdown.inlinepatterns.Pattern.getCompiledRegExp() -> re.Pattern
Return a compiled regular expression.
methodmarkdown.inlinepatterns.Pattern.handleMatch(m:re.Match[str]) -> etree.Element | str
Return a ElementTree element from the given match.
methodmarkdown.inlinepatterns.Pattern.type() -> str
Return class name, to define pattern type
methodmarkdown.inlinepatterns.Pattern.unescape(text:str) -> str
Return unescaped text given text with an inline placeholder.
classmarkdown.inlinepatterns.ReferenceInlineProcessor
Match to a stored reference and return link element.
methodmarkdown.inlinepatterns.ReferenceInlineProcessor.evalId(data:str, index:int, text:str) -> tuple[str | None, int, bool]
Evaluate the id portion of `[ref][id]`.
classmarkdown.inlinepatterns.ShortImageReferenceInlineProcessor
Short form of image reference: `![ref]`.
methodmarkdown.inlinepatterns.ShortImageReferenceInlineProcessor.evalId(data:str, index:int, text:str) -> tuple[str, int, bool]
Evaluate the id of `[ref]`.
classmarkdown.inlinepatterns.ShortReferenceInlineProcessor
Short form of reference: `[google]`.
methodmarkdown.inlinepatterns.ShortReferenceInlineProcessor.evalId(data:str, index:int, text:str) -> tuple[str, int, bool]
Evaluate the id of `[ref]`.
classmarkdown.inlinepatterns.SimpleTextInlineProcessor
Return a simple text of `group(1)` of a Pattern.
classmarkdown.inlinepatterns.SimpleTextPattern
Return a simple text of `group(2)` of a Pattern.
methodmarkdown.inlinepatterns.SimpleTextPattern.handleMatch(m:re.Match[str]) -> str
Return string content of `group(2)` of a matching pattern.
classmarkdown.inlinepatterns.SubstituteTagInlineProcessor
Return an element of type `tag` with no children.
classmarkdown.inlinepatterns.SubstituteTagPattern
Return an element of type `tag` with no children.
funcmarkdown.inlinepatterns.build_inlinepatterns(md:Markdown, **kwargs:Any) -> util.Registry[InlineProcessor]
Build the default set of inline patterns for Markdown.
funcmarkdown.inlinepatterns.dequote(string:str) -> str
Remove quotes from around a string.
classmarkdown.postprocessors.AndSubstitutePostprocessor
Restore valid entities
classmarkdown.postprocessors.RawHtmlPostprocessor
Restore raw html to the document.
methodmarkdown.postprocessors.RawHtmlPostprocessor.isblocklevel(html:str) -> bool
Check is block of HTML is block-level.
methodmarkdown.postprocessors.RawHtmlPostprocessor.run(text:str) -> str
Iterate over html stash and restore html.
methodmarkdown.postprocessors.RawHtmlPostprocessor.stash_to_string(text:str) -> str
Convert a stashed object to a string.
classmarkdown.postprocessors.UnescapePostprocessor
Restore escaped chars.
funcmarkdown.postprocessors.build_postprocessors(md:Markdown, **kwargs:Any) -> util.Registry[Postprocessor]
Build the default postprocessors for Markdown.
classmarkdown.preprocessors.NormalizeWhitespace
Normalize whitespace for consistent parsing.
classmarkdown.preprocessors.Preprocessor
Preprocessors are run after the text is broken into lines.
funcmarkdown.serializers.to_html_string(element:Element) -> str
Serialize element and its children to a string of HTML5.
funcmarkdown.serializers.to_xhtml_string(element:Element) -> str
Serialize element and its children to a string of XHTML.
methodmarkdown.treeprocessors.InlineProcessor.run(tree:etree.Element, ancestors:list[str] | None=None) -> etree.Element
Apply inline patterns to a parsed Markdown tree.
classmarkdown.treeprocessors.PrettifyTreeprocessor
Add line breaks to the html document.
methodmarkdown.treeprocessors.PrettifyTreeprocessor.run(root:etree.Element) -> None
Add line breaks to `Element` object and its children.
classmarkdown.treeprocessors.UnescapeTreeprocessor
Restore escaped chars
methodmarkdown.treeprocessors.UnescapeTreeprocessor.run(root:etree.Element) -> None
Loop over all elements and unescape all text.
funcmarkdown.treeprocessors.build_treeprocessors(md:Markdown, **kwargs:Any) -> util.Registry[Treeprocessor]
Build the default `treeprocessors` for Markdown.
classmarkdown.util.AtomicString
A string which should not be further processed.
classmarkdown.util.Processor
The base class for all processors.
classmarkdown.util.Registry
A priority sorted registry.
methodmarkdown.util.Registry.deregister(name:str, strict:bool=True) -> None
Remove an item from the registry.
methodmarkdown.util.Registry.get_index_for_name(name:str) -> int
Return the index of the given name.
methodmarkdown.util.Registry.register(item:_T, name:str, priority:float) -> None
Add an item to the registry with the given name and priority.
funcmarkdown.util.code_escape(text:str) -> str
HTML escape a string of code.
funcmarkdown.util.parseBoolValue(value:str | None, fail_on_errors:bool=True, preserve_none:bool=False) -> bool | None
Parses a string representing a boolean value.

About this data

These signatures were extracted from the public source of Python-Markdown/markdown using Python's ast module. Argument names, default values, type annotations and return types are taken verbatim from the code. Implementation bodies are never stored. See how it works for details.

Back to all 805 libraries