/** * Matches common Markdown code blocks to exclude them from further processing (e.g. LaTeX). * - Fenced: ```...``` * - Inline: `...` (does NOT support nested backticks or multi-backtick syntax) * * Note: This pattern does not handle advanced cases like: * `` `code with `backticks` `` or \\``...\\`` */ export const CODE_BLOCK_REGEXP = /(```[\s\S]*?```|`[^`\n]+`)/g; /** * Matches LaTeX math delimiters \(...\) and \[...\] only when not preceded by a backslash (i.e., not escaped), * while also capturing code blocks (```, `...`) so they can be skipped during processing. * * Uses negative lookbehind `(? ` or `>`) on a markdown line. */ export const LATEX_BLOCKQUOTE_PREFIX_REGEXP = /^(>\s*)/; /** Matches the placeholder inserted by the protect/restore pipeline for a * protected LaTeX expression. Group 1 is the index into `latexExpressions`. */ export const LATEX_PLACEHOLDER_REGEXP = /<>/g; /** Matches the placeholder inserted by the protect/restore pipeline for a * protected code block. Group 1 is the index into `codeBlocks`. */ export const CODE_BLOCK_PLACEHOLDER_REGEXP = /<>/g; /** Matches a `$` immediately followed by a digit, which is treated as a * currency amount (e.g. `$5`) and escaped to `\$5` so it isn't parsed as math. */ export const LATEX_CURRENCY_DOLLAR_REGEXP = /\$(?=\d)/g; /** Captures remaining `$$...$$`, `\[...\]`, `\(...\)` (only unescaped via * `(?