all2md.utils.flavors

Markdown flavor definitions and capabilities.

This module defines different markdown dialects/flavors and their capabilities. Each flavor specifies which markdown features are supported, allowing the renderer to adapt its output accordingly.

Supported Flavors

  • CommonMark: Strict CommonMark specification

  • GFM (GitHub Flavored Markdown): CommonMark plus GitHub extensions

  • MultiMarkdown: CommonMark plus MultiMarkdown extensions (footnotes, tables, etc.)

  • Pandoc: Pandoc-flavored Markdown with extensive extensions

  • Kramdown: Kramdown-flavored Markdown (Ruby Markdown processor)

  • MarkdownPlus: All extensions enabled

class all2md.utils.flavors.MarkdownFlavor

Bases: ABC

Abstract base class for markdown flavors.

A flavor defines which markdown features are supported and how they should be rendered. Subclasses should implement capability checks for all extended features.

abstract property name: str

Get the flavor name.

Returns:

Human-readable flavor name

Return type:

str

abstractmethod supports_tables() bool

Check if this flavor supports pipe tables.

Returns:

True if pipe tables are supported

Return type:

bool

abstractmethod supports_task_lists() bool

Check if this flavor supports task lists (checkboxes).

Returns:

True if task lists are supported

Return type:

bool

abstractmethod supports_strikethrough() bool

Check if this flavor supports strikethrough text.

Returns:

True if strikethrough is supported

Return type:

bool

Check if this flavor supports automatic URL linking.

Returns:

True if autolinks are supported

Return type:

bool

abstractmethod supports_footnotes() bool

Check if this flavor supports footnotes.

Returns:

True if footnotes are supported

Return type:

bool

abstractmethod supports_definition_lists() bool

Check if this flavor supports definition lists.

Returns:

True if definition lists are supported

Return type:

bool

abstractmethod supports_math() bool

Check if this flavor supports math blocks.

Returns:

True if math blocks are supported

Return type:

bool

abstractmethod supports_mark() bool

Check if this flavor supports highlight/mark syntax (==text==).

Returns:

True if highlight (mark) syntax is supported

Return type:

bool

supports_superscript() bool

Check if this flavor natively supports ^text^ superscript syntax.

Concrete (default False) rather than abstract: superscript is part of the pymdownx / Material mark family, natively supported only by the MarkdownPlus flavor. Other flavors fall back per superscript_mode.

Returns:

True if ^text^ superscript syntax is supported

Return type:

bool

supports_subscript() bool

Check if this flavor natively supports ~text~ subscript syntax.

See supports_superscript(); defaults to False and is overridden by the MarkdownPlus flavor.

Returns:

True if ~text~ subscript syntax is supported

Return type:

bool

supports_underline() bool

Check if this flavor natively supports ^^text^^ underline syntax.

Concrete (default False) rather than abstract: underline is the pymdownx / Material “insert” extension, natively supported only by the MarkdownPlus flavor. Other flavors fall back per underline_mode.

Returns:

True if ^^text^^ underline syntax is supported

Return type:

bool

abstractmethod supports_admonitions() bool

Check if this flavor supports Material for MkDocs admonitions.

This covers the !!! note "Title" block syntax and its collapsible ??? / ???+ variants.

Returns:

True if admonition blocks are supported

Return type:

bool

class all2md.utils.flavors.CommonMarkFlavor

Bases: MarkdownFlavor

Strict CommonMark specification flavor.

This flavor adheres strictly to the CommonMark specification with no extensions. Features not in the spec are either rendered as HTML or ignored.

References

CommonMark Spec: https://spec.commonmark.org/

property name: str

Get the flavor name.

Returns:

‘CommonMark’

Return type:

str

supports_tables() bool

Tables are not in CommonMark spec.

Returns:

False

Return type:

bool

supports_task_lists() bool

Task lists are not in CommonMark spec.

Returns:

False

Return type:

bool

supports_strikethrough() bool

Strikethrough is not in CommonMark spec.

Returns:

False

Return type:

bool

CommonMark supports autolinks in angle brackets only.

Returns:

True

Return type:

bool

supports_footnotes() bool

Footnotes are not in CommonMark spec.

Returns:

False

Return type:

bool

supports_definition_lists() bool

Definition lists are not in CommonMark spec.

Returns:

False

Return type:

bool

supports_math() bool

Math blocks are not in CommonMark spec.

Returns:

False

Return type:

bool

supports_mark() bool

Highlight/mark syntax is not in CommonMark spec.

Returns:

False

Return type:

bool

supports_admonitions() bool

Admonitions are not in CommonMark spec.

Returns:

False

Return type:

bool

class all2md.utils.flavors.GFMFlavor

Bases: MarkdownFlavor

GitHub Flavored Markdown (GFM) flavor.

This flavor includes all CommonMark features plus GitHub extensions: - Pipe tables - Task lists - Strikethrough - Autolinks (extended)

References

GFM Spec: https://github.github.com/gfm/

property name: str

Get the flavor name.

Returns:

‘GFM’

Return type:

str

supports_tables() bool

GFM supports pipe tables.

Returns:

True

Return type:

bool

supports_task_lists() bool

GFM supports task lists.

Returns:

True

Return type:

bool

supports_strikethrough() bool

GFM supports strikethrough with tildes.

Returns:

True

Return type:

bool

GFM supports extended autolinks.

Returns:

True

Return type:

bool

supports_footnotes() bool

GFM does not support footnotes in the spec.

Returns:

False

Return type:

bool

supports_definition_lists() bool

GFM does not support definition lists.

Returns:

False

Return type:

bool

supports_math() bool

GFM supports math blocks with $$ delimiters.

Returns:

True

Return type:

bool

supports_mark() bool

GFM does not support highlight/mark syntax.

Returns:

False

Return type:

bool

supports_admonitions() bool

GFM does not support Material admonitions.

GitHub renders its own alert syntax (> [!NOTE]) rather than the !!! admonition blocks used by Material for MkDocs.

Returns:

False

Return type:

bool

class all2md.utils.flavors.MultiMarkdownFlavor

Bases: MarkdownFlavor

MultiMarkdown flavor.

This flavor implements the MultiMarkdown specification which extends CommonMark with: - Pipe tables - Footnotes - Definition lists - Math blocks - Citations - Abbreviations

MultiMarkdown does not include task lists or autolinks by default.

References

MultiMarkdown: https://fletcherpenney.net/multimarkdown/

property name: str

Get the flavor name.

Returns:

‘MultiMarkdown’

Return type:

str

supports_tables() bool

MultiMarkdown supports pipe tables.

Returns:

True

Return type:

bool

supports_task_lists() bool

MultiMarkdown does not support task lists.

Returns:

False

Return type:

bool

supports_strikethrough() bool

MultiMarkdown does not support strikethrough in standard spec.

Returns:

False

Return type:

bool

MultiMarkdown supports basic autolinks (angle brackets).

Returns:

True

Return type:

bool

supports_footnotes() bool

MultiMarkdown supports footnotes.

Returns:

True

Return type:

bool

supports_definition_lists() bool

MultiMarkdown supports definition lists.

Returns:

True

Return type:

bool

supports_math() bool

MultiMarkdown supports math blocks with LaTeX syntax.

Returns:

True

Return type:

bool

supports_mark() bool

MultiMarkdown does not support highlight/mark syntax.

Returns:

False

Return type:

bool

supports_admonitions() bool

MultiMarkdown does not support Material admonitions.

Returns:

False

Return type:

bool

class all2md.utils.flavors.PandocFlavor

Bases: MarkdownFlavor

Pandoc Markdown flavor.

This flavor implements Pandoc’s extended Markdown syntax, which is one of the most feature-rich markdown dialects: - All GFM features (tables, strikethrough, task lists) - Footnotes - Definition lists - Math blocks (inline and display) - Superscript and subscript - Fenced divs - Attributes on elements - And many more extensions

References

Pandoc Markdown: https://pandoc.org/MANUAL.html#pandocs-markdown

property name: str

Get the flavor name.

Returns:

‘Pandoc’

Return type:

str

supports_tables() bool

Pandoc supports multiple table formats.

Returns:

True

Return type:

bool

supports_task_lists() bool

Pandoc supports task lists.

Returns:

True

Return type:

bool

supports_strikethrough() bool

Pandoc supports strikethrough.

Returns:

True

Return type:

bool

Pandoc supports autolinks.

Returns:

True

Return type:

bool

supports_footnotes() bool

Pandoc supports footnotes.

Returns:

True

Return type:

bool

supports_definition_lists() bool

Pandoc supports definition lists.

Returns:

True

Return type:

bool

supports_math() bool

Pandoc supports math with TeX syntax.

Returns:

True

Return type:

bool

supports_mark() bool

Pandoc does not support == highlight syntax.

Returns:

False

Return type:

bool

supports_admonitions() bool

Pandoc uses fenced divs rather than Material !!! admonitions.

Returns:

False

Return type:

bool

class all2md.utils.flavors.KramdownFlavor

Bases: MarkdownFlavor

Kramdown Markdown flavor.

This flavor implements Kramdown (Ruby Markdown processor) syntax: - All GFM features (tables, strikethrough, task lists) - Footnotes - Definition lists - Math blocks with $$ delimiters - Attributes on elements - Automatic ID generation for headers

Kramdown is similar to GFM but adds footnotes and some other extensions.

References

Kramdown: https://kramdown.gettalong.org/

property name: str

Get the flavor name.

Returns:

‘Kramdown’

Return type:

str

supports_tables() bool

Kramdown supports pipe tables.

Returns:

True

Return type:

bool

supports_task_lists() bool

Kramdown supports task lists (GFM-style).

Returns:

True

Return type:

bool

supports_strikethrough() bool

Kramdown supports strikethrough.

Returns:

True

Return type:

bool

Kramdown supports autolinks.

Returns:

True

Return type:

bool

supports_footnotes() bool

Kramdown supports footnotes.

Returns:

True

Return type:

bool

supports_definition_lists() bool

Kramdown supports definition lists.

Returns:

True

Return type:

bool

supports_math() bool

Kramdown supports math blocks with $$ delimiters.

Returns:

True

Return type:

bool

supports_mark() bool

Kramdown does not support == highlight syntax.

Returns:

False

Return type:

bool

supports_admonitions() bool

Kramdown does not support Material !!! admonitions.

Returns:

False

Return type:

bool

class all2md.utils.flavors.MarkdownPlusFlavor

Bases: MarkdownFlavor

Extended markdown flavor with all features enabled.

This flavor supports all markdown extensions including: - All GFM features - Footnotes - Definition lists - Math blocks - And more

This is the most permissive flavor, useful when maximum feature support is desired.

property name: str

Get the flavor name.

Returns:

‘MarkdownPlus’

Return type:

str

supports_tables() bool

MarkdownPlus supports tables.

Returns:

True

Return type:

bool

supports_task_lists() bool

MarkdownPlus supports task lists.

Returns:

True

Return type:

bool

supports_strikethrough() bool

MarkdownPlus supports strikethrough.

Returns:

True

Return type:

bool

MarkdownPlus supports autolinks.

Returns:

True

Return type:

bool

supports_footnotes() bool

MarkdownPlus supports footnotes.

Returns:

True

Return type:

bool

supports_definition_lists() bool

MarkdownPlus supports definition lists.

Returns:

True

Return type:

bool

supports_math() bool

MarkdownPlus supports math blocks.

Returns:

True

Return type:

bool

supports_mark() bool

MarkdownPlus supports == highlight syntax.

Returns:

True

Return type:

bool

supports_superscript() bool

MarkdownPlus supports ^text^ superscript syntax.

Returns:

True

Return type:

bool

supports_subscript() bool

MarkdownPlus supports ~text~ subscript syntax.

Returns:

True

Return type:

bool

supports_underline() bool

MarkdownPlus supports ^^text^^ underline syntax.

Returns:

True

Return type:

bool

supports_admonitions() bool

MarkdownPlus supports Material for MkDocs admonitions.

Returns:

True

Return type:

bool