SurfSense/surfsense_web/lib/markdown/code-regions.ts
DESKTOP-RTLN3BA\$punk 7aeb8bb0a8 feat(markdown): enable citation rendering in MarkdownViewer and related components
- Added `enableCitations` prop to `MarkdownViewer` to support interactive citation badges.
- Updated instances of `MarkdownViewer` across various components to utilize the new citation feature.
- Enhanced citation processing in `PlateEditor` for read-only views, ensuring citations are rendered correctly without affecting markdown serialization.
- Refactored citation handling in `InlineCitation` and `MarkdownText` to improve citation context management.
2026-04-30 18:40:55 -07:00

8 lines
446 B
TypeScript

// Matches fenced (```...```) and inline (`...`) code regions. Used by MDX
// escaping and citation preprocessing — single source of truth so future
// edits stay in sync.
//
// String.split() with this capturing pattern places non-code parts at even
// indexes and matched code regions at odd indexes — preserve odd-indexed
// segments verbatim when transforming markdown.
export const FENCED_OR_INLINE_CODE = /(```[\s\S]*?```|`[^`\n]+`)/g;