inline-token-renderer
One definition of an inline token that renders in both Reading view and Live Preview.
A token is a regular expression and a render function. registerInlineTokenRenderer registers a Markdown post processor that renders every match found in the rendered text, and an editor extension that replaces every match with a widget in Live Preview, both calling the same function, so the two views cannot drift apart.
The Reading-view half walks text nodes only, so a token is never matched across an element boundary, and it skips text inside the elements skipSelector names (code by default). The editor half matches each line’s source text, Markdown markup included; see shouldDecorate to skip code there.
Interfaces
Section titled “Interfaces”| Interface | Description |
|---|---|
| CreateInlineTokenPostProcessorParams | Parameters for createInlineTokenPostProcessor. |
| RegisterInlineTokenRendererParams | Parameters for registerInlineTokenRenderer. |
Functions
Section titled “Functions”| Function | Description |
|---|---|
| createInlineTokenPostProcessor | Creates a Markdown post processor that renders every match of a regular expression found in the rendered text. |
| registerInlineTokenRenderer | Registers an inline token in both Reading view and Live Preview, from one definition. Obsidian ties both registrations to the plugin’s lifetime and offers no way to remove either earlier. |
Variables
Section titled “Variables”| Variable | Description |
|---|---|
| DEFAULT_INLINE_TOKEN_SKIP_SELECTOR | The default selector of the elements whose text is never matched in Reading view. |