Skip to main content

AlertRuleFactory

ClassSource

AlertRuleFactory(
titles: Sequence[str] | None = None,
icons: Mapping[str, str] | None = None,
class_prefix: str = "markdown-alert",
*,
parse_nested: bool = True,
match_case_sensitive: bool = False
)

Identifies blockquote tokens and transforms them to alert tokens.

Arguments​

Requires​

NameTypeRequired
Description
titlesSequence[str] | None

The allowed titles that would be used to detect the alert box.

If not specified, will use the default list: ("tip", "note", "important", "warning", "caution")

iconsMapping[str, str] | NoneThe icon storage. It is a mapping from the title to the icon SVG text.
class_prefixstrThe prefix of the class name when the alert box is produced.
parse_nestedboolA flag. If specified, will render the nested alert boxes.
match_case_sensitiveboolA flag. If specified, will match the case of the identifier (title) when rendering the alert boxes.

Methods​

get_rule​

v_1: Callable[[StateCore], None] = self.get_rule()

Produce the rule plugin of the MarkdownIt.

Returns​

NameType
Description
v_1Callable[[StateCore], None]The rule function that will be used as the plugin of the Markdown parser.

Properties​

pattern​

pattern: Pattern[str] = self.pattern

The pattern used for matching the alert boxes in the Markdown text.