![]() |
Qucs-S S-parameter Viewer & RF Synthesis Tools
|
Public Member Functions | |
| __init__ (self, str|PresetType config="commonmark", Mapping[str, Any]|None options_update=None, *Callable[[MarkdownIt], RendererProtocol] renderer_cls=RendererHTML) | |
| str | __repr__ (self) |
| ParserInline | __getitem__ (self, Literal["inline"] name) |
| ParserBlock | __getitem__ (self, Literal["block"] name) |
| ParserCore | __getitem__ (self, Literal["core"] name) |
| RendererProtocol | __getitem__ (self, Literal["renderer"] name) |
| Any | __getitem__ (self, str name) |
| Any | __getitem__ (self, str name) |
| None | set (self, OptionsType options) |
| MarkdownIt | configure (self, str|PresetType presets, Mapping[str, Any]|None options_update=None) |
| dict[str, list[str]] | get_all_rules (self) |
| dict[str, list[str]] | get_active_rules (self) |
| MarkdownIt | enable (self, str|Iterable[str] names, bool ignoreInvalid=False) |
| MarkdownIt | disable (self, str|Iterable[str] names, bool ignoreInvalid=False) |
| Generator[None, None, None] | reset_rules (self) |
| None | add_render_rule (self, str name, Callable[..., Any] function, str fmt="html") |
| MarkdownIt | use (self, Callable[..., None] plugin, *Any params, **Any options) |
| list[Token] | parse (self, str src, EnvType|None env=None) |
| Any | render (self, str src, EnvType|None env=None) |
| list[Token] | parseInline (self, str src, EnvType|None env=None) |
| Any | renderInline (self, str src, EnvType|None env=None) |
| bool | validateLink (self, str url) |
| str | normalizeLink (self, str url) |
| str | normalizeLinkText (self, str link) |
Public Attributes | |
| utils | |
| helpers | |
| inline | |
| block | |
| core | |
| renderer | |
| linkify | |
| options | |
| markdown_it.main.MarkdownIt.__init__ | ( | self, | |
| str | PresetType | config = "commonmark", |
||
| Mapping[str, Any] | None | options_update = None, |
||
| *Callable[[MarkdownIt], RendererProtocol] | renderer_cls = RendererHTML |
||
| ) |
Main parser class
:param config: name of configuration to load or a pre-defined dictionary
:param options_update: dictionary that will be merged into ``config["options"]``
:param renderer_cls: the class to load as the renderer:
``self.renderer = renderer_cls(self)
| None markdown_it.main.MarkdownIt.add_render_rule | ( | self, | |
| str | name, | ||
| Callable[..., Any] | function, | ||
| str | fmt = "html" |
||
| ) |
Add a rule for rendering a particular Token type. Only applied when ``renderer.__output__ == fmt``
| MarkdownIt markdown_it.main.MarkdownIt.configure | ( | self, | |
| str | PresetType | presets, | ||
| Mapping[str, Any] | None | options_update = None |
||
| ) |
Batch load of all options and component settings. This is an internal method, and you probably will not need it. But if you will - see available presets and data structure [here](https://github.com/markdown-it/markdown-it/tree/master/lib/presets) We strongly recommend to use presets instead of direct config loads. That will give better compatibility with next versions.
| MarkdownIt markdown_it.main.MarkdownIt.disable | ( | self, | |
| str | Iterable[str] | names, | ||
| bool | ignoreInvalid = False |
||
| ) |
The same as [[MarkdownIt.enable]], but turn specified rules off. (chainable) :param names: rule name or list of rule names to disable. :param ignoreInvalid: set `true` to ignore errors when rule not found.
| MarkdownIt markdown_it.main.MarkdownIt.enable | ( | self, | |
| str | Iterable[str] | names, | ||
| bool | ignoreInvalid = False |
||
| ) |
Enable list or rules. (chainable)
:param names: rule name or list of rule names to enable.
:param ignoreInvalid: set `true` to ignore errors when rule not found.
It will automatically find appropriate components,
containing rules with given names. If rule not found, and `ignoreInvalid`
not set - throws exception.
Example::
md = MarkdownIt().enable(['sub', 'sup']).disable('smartquotes')
| dict[str, list[str]] markdown_it.main.MarkdownIt.get_active_rules | ( | self | ) |
Return the names of all active rules.
| dict[str, list[str]] markdown_it.main.MarkdownIt.get_all_rules | ( | self | ) |
Return the names of all active rules.
| str markdown_it.main.MarkdownIt.normalizeLink | ( | self, | |
| str | url | ||
| ) |
Normalize destination URLs in links
::
[label]: destination 'title'
^^^^^^^^^^^
| str markdown_it.main.MarkdownIt.normalizeLinkText | ( | self, | |
| str | link | ||
| ) |
Normalize autolink content
::
<destination>
~~~~~~~~~~~
| list[Token] markdown_it.main.MarkdownIt.parse | ( | self, | |
| str | src, | ||
| EnvType | None | env = None |
||
| ) |
Parse the source string to a token stream
:param src: source string
:param env: environment sandbox
Parse input string and return list of block tokens (special token type
"inline" will contain list of inline tokens).
`env` is used to pass data between "distributed" rules and return additional
metadata like reference info, needed for the renderer. It also can be used to
inject data in specific cases. Usually, you will be ok to pass `{}`,
and then pass updated object to renderer.
| list[Token] markdown_it.main.MarkdownIt.parseInline | ( | self, | |
| str | src, | ||
| EnvType | None | env = None |
||
| ) |
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` object.
| Any markdown_it.main.MarkdownIt.render | ( | self, | |
| str | src, | ||
| EnvType | None | env = None |
||
| ) |
Render markdown string into html. It does all magic for you :).
:param src: source string
:param env: environment sandbox
:returns: The output of the loaded renderer
`env` can be used to inject additional metadata (`{}` by default).
But you will not need it with high probability. See also comment
in [[MarkdownIt.parse]].
| Any markdown_it.main.MarkdownIt.renderInline | ( | self, | |
| str | src, | ||
| EnvType | None | env = None |
||
| ) |
Similar to [[MarkdownIt.render]] but for single paragraph content. :param src: source string :param env: environment sandbox Similar to [[MarkdownIt.render]] but for single paragraph content. Result will NOT be wrapped into `<p>` tags.
| Generator[None, None, None] markdown_it.main.MarkdownIt.reset_rules | ( | self | ) |
A context manager, that will reset the current enabled rules on exit.
| None markdown_it.main.MarkdownIt.set | ( | self, | |
| OptionsType | options | ||
| ) |
Set parser options (in the same format as in constructor). Probably, you will never need it, but you can change options after constructor call. __Note:__ To achieve the best possible performance, don't modify a `markdown-it` instance options on the fly. If you need multiple configurations it's best to create multiple instances and initialize each with separate config.
| MarkdownIt markdown_it.main.MarkdownIt.use | ( | self, | |
| Callable[..., None] | plugin, | ||
| *Any | params, | ||
| **Any | options | ||
| ) |
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')
md = MarkdownIt().use(plugin, 'foo_replace', 'text', func)
| bool markdown_it.main.MarkdownIt.validateLink | ( | self, | |
| str | url | ||
| ) |
Validate if the URL link is allowed in output. This validator can prohibit more than really needed to prevent XSS. It's a tradeoff to keep code simple and to be secure by default. Note: the url should be normalized at this point, and existing entities decoded.