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

Method parseInline

markdown_it/main.py:289–307  ·  view source on GitHub ↗

The same as [[MarkdownIt.parse]] but skip all block rules. :param src: source string :param env: environment sandbox It returns the block tokens list with the single `inline` element, containing parsed inline tokens in `children` property. Also updates `env`

(self, src: str, env: EnvType | None = None)

Source from the content-addressed store, hash-verified

287 return self.renderer.render(self.parse(src, env), self.options, env)
288
289 def parseInline(self, src: str, env: EnvType | None = None) -> list[Token]:
290 """The same as [[MarkdownIt.parse]] but skip all block rules.
291
292 :param src: source string
293 :param env: environment sandbox
294
295 It returns the
296 block tokens list with the single `inline` element, containing parsed inline
297 tokens in `children` property. Also updates `env` object.
298 """
299 env = {} if env is None else env
300 if not isinstance(env, MutableMapping):
301 raise TypeError(f"Input data should be an MutableMapping, not {type(env)}")
302 if not isinstance(src, str):
303 raise TypeError(f"Input data should be a string, not {type(src)}")
304 state = StateCore(src, self, env)
305 state.inlineMode = True
306 self.core.process(state)
307 return state.tokens
308
309 def renderInline(self, src: str, env: EnvType | None = None) -> Any:
310 """Similar to [[MarkdownIt.render]] but for single paragraph content.

Callers 6

renderInlineMethod · 0.95
test_parseInlineFunction · 0.95
test_emptyStrFunction · 0.95
TestOneInputFunction · 0.95

Calls 2

StateCoreClass · 0.85
processMethod · 0.80