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

Method use

markdown_it/main.py:235–250  ·  view source on GitHub ↗

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
    )

Source from the content-addressed store, hash-verified

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

Callers 10

test_inline_afterFunction · 0.80
test_inline_beforeFunction · 0.80
test_inline_atFunction · 0.80
test_block_afterFunction · 0.80
test_block_beforeFunction · 0.80
test_block_atFunction · 0.80
test_core_afterFunction · 0.80
test_core_beforeFunction · 0.80
test_core_atFunction · 0.80
test_add_terminator_charFunction · 0.80

Calls

no outgoing calls

Tested by 10

test_inline_afterFunction · 0.64
test_inline_beforeFunction · 0.64
test_inline_atFunction · 0.64
test_block_afterFunction · 0.64
test_block_beforeFunction · 0.64
test_block_atFunction · 0.64
test_core_afterFunction · 0.64
test_core_beforeFunction · 0.64
test_core_atFunction · 0.64
test_add_terminator_charFunction · 0.64