Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions markdown_it/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@ def add_render_rule(
"""Add a rule for rendering a particular Token type.

Only applied when ``renderer.__output__ == fmt``

:param name: must equal the ``type`` of the token(s) this should render
(e.g. ``"heading_open"``, ``"fence"``); it is not an arbitrary label.
If it does not match any token type actually produced by the active
rules, ``function`` will silently never be called.
"""
if self.renderer.__output__ == fmt:
self.renderer.rules[name] = function.__get__(self.renderer) # type: ignore
Expand Down
Loading