codemirror/inline-token-widgets
Creates an editor extension that replaces every match of a regular expression with a widget in Live Preview, and shows the source again while a selection touches it, the way Obsidian treats its own links and formatting.
Only the visible ranges are matched, line by line, so a token never spans two lines. The decorations are rebuilt when the document, the viewport, the selection, the Live Preview mode or the configuration changes; a configuration change is what a SettingsFacetComponent dispatches, so a render that reads a settings facet re-runs when the settings do.
Outside an Obsidian Markdown editor there is no editorLivePreviewField, and the widgets are shown.
Interfaces
Section titled “Interfaces”| Interface | Description |
|---|---|
| CreateInlineTokenWidgetsExtensionParams | Parameters for createInlineTokenWidgetsExtension. |
| InlineTokenRenderParams | Parameters handed to an inline token render function. |
| InlineTokenShouldDecorateParams | Parameters handed to CreateInlineTokenWidgetsExtensionParams.shouldDecorate. |
Functions
Section titled “Functions”| Function | Description |
|---|---|
| createInlineTokenWidgetsExtension | Creates an editor extension that replaces every match of a regular expression with a widget in Live Preview. |
| execAll | Lists every non-empty match of a global regular expression in a text. |
| toGlobalRegExp | Copies a regular expression with the g flag set, so matching never moves the caller’s lastIndex. |
| Type | Description |
|---|---|
| InlineTokenRenderFunction | Renders an inline token into its container element. |