MCPcopy Create free account
hub / github.com/executablebooks/markdown-it-py / add_render_rule

Method add_render_rule

markdown_it/main.py:225–233  ·  view source on GitHub ↗

Add a rule for rendering a particular Token type. Only applied when ``renderer.__output__ == fmt``

(
        self, name: str, function: Callable[..., Any], fmt: str = "html"
    )

Source from the content-addressed store, hash-verified

223 self.inline.ruler2.enableOnly(chain_rules["inline2"])
224
225 def add_render_rule(
226 self, name: str, function: Callable[..., Any], fmt: str = "html"
227 ) -> None:
228 """Add a rule for rendering a particular Token type.
229
230 Only applied when ``renderer.__output__ == fmt``
231 """
232 if self.renderer.__output__ == fmt:
233 self.renderer.rules[name] = function.__get__(self.renderer) # type: ignore
234
235 def use(
236 self, plugin: Callable[..., None], *params: Any, **options: Any

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected