You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 371a3de
Browse filesBrowse the repository at this point in the historyBrowse files
fix(search): match a Note body as it renders, instead of rewriting the file
Replaces the serializer change with one that writes nothing.
The editor backslash-escapes every markdown-significant character in prose, so a
Note the reader sees as `{{TE_SERET}}` is stored as `{{TE\_SERET}}` and search —
which matches the stored value — could not find it. The previous approach undid
that escape in `postProcessSerializedMarkdown`, which meant re-deriving markdown
structure from the serialized string with regexes so it knew what was code. That
is a losing game: three review rounds, each finding another construct it did not
model (longer fences, then delimiter-prefixed lines, then quoted fences), and
each miss REWROTE somebody's code. `markdown-fidelity.ts` is back to staging,
byte for byte.
The escape is now undone on the matching side only. A field declares
`searchTextFormat: 'markdown'` (the Note body is the only one), and the indexer
matches it against `projectEscapedMarkdownForSearch(value)` — a total,
structure-free function that returns the rendered text plus an index back into
the source. Ranges stay in source coordinates, so replace still rewrites the
whole `\_` and never strands a backslash.
The asymmetry is the whole point: a matcher that de-escapes something a fence
would have kept literal changes only which text highlights, and no caller writes
it back. A rewriter making the identical mistake corrupts the file. So there is
nothing here that needs to know about fences at all.
Two consequences worth having: existing notes are searchable immediately rather
than after their next edit, and no stored byte changes, so no document the
editor has ever written can be affected.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/markdown-fidelity.ts
mode?: 'basic'|'advanced'|'both'|'trigger'|'trigger-advanced'// Default is 'both' if not specified. 'trigger' means only shown in trigger mode. 'trigger-advanced' is the advanced side of a trigger field — either a canonical pair member or a standalone field shown under the block-level advanced toggle
271
271
canonicalParamId?: string
272
+
/**
273
+
* Declares that the stored value is markdown, so workflow search matches it
274
+
* against the text it RENDERS as rather than its source.
275
+
*
276
+
* The rich-text editor backslash-escapes every markdown-significant character
277
+
* in prose, so a Note body the reader sees as `SB_ACTION` is stored as
278
+
* `SB\_ACTION` and would otherwise be unfindable by what is on screen. Ranges
279
+
* stay in source coordinates, so replace still rewrites the escaped span.
280
+
*
281
+
* Omit for every ordinary field: a code or plain-text value is searched as
282
+
* stored, where a backslash is the author's own character.
283
+
*/
284
+
searchTextFormat?: 'markdown'
272
285
/** Controls parameter visibility in agent/tool-input context */
0 commit comments