fix: render inline callout labels containing square brackets in Live Preview

The Live Preview decorator used `[^\]]*` for the label, which stops at the
first `]`. A multi-part label like `[!!mail|test [with brackets]|var(...)]`
broke as soon as it hit the `]` after "brackets", so the closing ]` no longer
matched and the callout stayed as raw code. Reading mode was unaffected
because its post-processor checks startsWith/endsWith. Switch the class to
`[^`]+` so it matches up to the bounding backtick, consistent with the
post-processor and cursor-detection regexes.

Co-authored-by: Thierry VUILLEMIN <6804067+vuillemint@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@gapmiss 2026-06-25 16:37:38 -05:00
parent 858a209cbe
commit 3755d19417

View file

@ -5,7 +5,7 @@ import { ViewPlugin, WidgetType, EditorView, ViewUpdate, Decoration, DecorationS
import { RangeSetBuilder } from "@codemirror/state";
import { InlineCallout } from '../callout/builder';
const REGEXP = /(`\[!!([^\]]*)\]`)/gm;
const REGEXP = /(`\[!!([^`]+)\]`)/gm;
export const viewPlugin = ViewPlugin.fromClass(class {
decorations: DecorationSet;