Load specified plugin with given params into current parser instance. (chainable) It's just a sugar to call `plugin(md, params)` with curring. Example:: def func(tokens, idx): tokens[idx].content = tokens[idx].content.replace('foo', 'bar') m
(
self, plugin: Callable[..., None], *params: Any, **options: Any
)
| 233 | self.renderer.rules[name] = function.__get__(self.renderer) # type: ignore |
| 234 | |
| 235 | def use( |
| 236 | self, plugin: Callable[..., None], *params: Any, **options: Any |
| 237 | ) -> MarkdownIt: |
| 238 | """Load specified plugin with given params into current parser instance. (chainable) |
| 239 | |
| 240 | It's just a sugar to call `plugin(md, params)` with curring. |
| 241 | |
| 242 | Example:: |
| 243 | |
| 244 | def func(tokens, idx): |
| 245 | tokens[idx].content = tokens[idx].content.replace('foo', 'bar') |
| 246 | md = MarkdownIt().use(plugin, 'foo_replace', 'text', func) |
| 247 | |
| 248 | """ |
| 249 | plugin(self, *params, **options) |
| 250 | return self |
| 251 | |
| 252 | def parse(self, src: str, env: EnvType | None = None) -> list[Token]: |
| 253 | """Parse the source string to a token stream |
no outgoing calls