LinYushen
|
d013a31db9
|
fix: escape special chars in image alt and file-card filename (MUL-2899) (#3644)
* fix: escape special chars in image alt and file-card filename during Markdown serialization
Filenames containing Markdown label characters ([, ], \, (, )) broke
the  and !file[name](url) syntax, causing raw Markdown to
render instead of the image/file card.
- Add shared escapeMarkdownLabel utility
- Apply escaping in file-card renderMarkdown
- Add renderMarkdown to ImageExtension for alt text escaping
- Add regression tests
Closes #3616
Co-authored-by: multica-agent <github@multica.ai>
* fix: address review — fix tokenizer regex, unescape labels, add regression tests
- Remove unused tokenizeFn (TS6133)
- Change file-card regex to (?:\\.|[^\]])* to handle escaped brackets
- Unescape labels in tokenize() and preprocessFileCards()
- Export ImageExtension for testability
- Rewrite tests: 3 describe blocks covering ImageExtension.renderMarkdown,
file-card tokenizer round-trip, and preprocessFileCards (6 tests total)
- typecheck and vitest both pass
Co-authored-by: multica-agent <github@multica.ai>
---------
Co-authored-by: multica-agent <github@multica.ai>
|
2026-06-02 14:33:45 +08:00 |
|