@lobehub/ui 2.16.0 → 2.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -95,7 +95,15 @@ export function escapeTextUnderscores(text) {
|
|
|
95
95
|
export function escapeCurrencyDollars(text) {
|
|
96
96
|
// Protect code blocks and existing LaTeX expressions from processing
|
|
97
97
|
var protectedStrings = [];
|
|
98
|
-
var content = text.replaceAll(
|
|
98
|
+
var content = text.replaceAll(
|
|
99
|
+
// Match patterns to protect (in order):
|
|
100
|
+
// 1. Code blocks: ```...```
|
|
101
|
+
// 2. Inline code: `...`
|
|
102
|
+
// 3. Display math: $$...$$
|
|
103
|
+
// 4. Inline math with LaTeX commands: $...\...$ (must contain backslash to distinguish from currency)
|
|
104
|
+
// 5. LaTeX bracket notation: \[...\]
|
|
105
|
+
// 6. LaTeX parenthesis notation: \(...\)
|
|
106
|
+
/(```[\S\s]*?```|`[^\n`]*`|\$\$[\S\s]*?\$\$|(?<!\\)\$(?!\$)(?=[\S\s]*?\\)[\S\s]*?(?<!\\)\$(?!\$)|\\\[[\S\s]*?\\]|\\\(.*?\\\))/g, function (match) {
|
|
99
107
|
protectedStrings.push(match);
|
|
100
108
|
return "<<PROTECTED_".concat(protectedStrings.length - 1, ">>");
|
|
101
109
|
});
|