@8btc/mditor 0.0.37 → 0.0.40
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.
- package/dist/index.css +2 -2
- package/dist/index.js +19 -19
- package/dist/index.min.js +1 -1
- package/dist/js/lute/lute.min.js +11 -0
- package/dist/js/mathjax/tex-svg-full.js +89129 -1
- package/dist/method.js +19 -19
- package/dist/method.min.js +1 -1
- package/dist/ts/markdown/mathRender.d.ts +0 -5
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/ts/markdown/mathContextMenu.ts +27 -17
- package/src/ts/markdown/mathRender.ts +12 -18
package/dist/js/lute/lute.min.js
CHANGED
|
@@ -254599,6 +254599,7 @@
|
|
|
254599
254599
|
// 匹配所有合法自定义标签(小写字母开头,含字母/数字/短横线)
|
|
254600
254600
|
const selfClosingRegex = /<([a-z][a-z0-9-]*)\s+([^>]*?)\s*\/>/gi;
|
|
254601
254601
|
md = md.replace(selfClosingRegex, function(match, tagName, attrs) {
|
|
254602
|
+
if (tagName.toLowerCase() === "br") return match;
|
|
254602
254603
|
return `<${tagName} ${attrs}></${tagName}>`;
|
|
254603
254604
|
});
|
|
254604
254605
|
|
|
@@ -254607,6 +254608,7 @@
|
|
|
254607
254608
|
const unclosedTagRegex = /<([a-z][a-z0-9-]*)\s+([^>]*?)>(?<!\/)(?!\s*<\/\1\s*>)/gi;
|
|
254608
254609
|
md = md.replace(unclosedTagRegex, function(match, tagName, attrs) {
|
|
254609
254610
|
// 兜底过滤:避免已闭合标签被重复处理
|
|
254611
|
+
if (tagName.toLowerCase() === "br") return match;
|
|
254610
254612
|
if (match.includes('/>') || match.endsWith(`></${tagName}>`)) {
|
|
254611
254613
|
return match;
|
|
254612
254614
|
}
|
|
@@ -254616,6 +254618,14 @@
|
|
|
254616
254618
|
|
|
254617
254619
|
return md;
|
|
254618
254620
|
}
|
|
254621
|
+
|
|
254622
|
+
function __vditorNormalizeBrTags(md) {
|
|
254623
|
+
if (!md || typeof md !== "string") return md;
|
|
254624
|
+
md = md.replace(/<br\s*><\s*\/\s*br\s*>/gi, "<br />");
|
|
254625
|
+
md = md.replace(/<br\s*\/\s*>/gi, "<br />");
|
|
254626
|
+
md = md.replace(/<br>/gi, "<br />");
|
|
254627
|
+
return md;
|
|
254628
|
+
}
|
|
254619
254629
|
|
|
254620
254630
|
if (typeof window !== "undefined" && window.Lute && typeof window.Lute.New === "function") {
|
|
254621
254631
|
var __origNew = window.Lute.New;
|
|
@@ -254628,6 +254638,7 @@
|
|
|
254628
254638
|
inst[name] = function(text) {
|
|
254629
254639
|
text = __vditorPreprocessBackslashMath(text);
|
|
254630
254640
|
text = __vditorPreprocessCustomTags(text);
|
|
254641
|
+
text = __vditorNormalizeBrTags(text);
|
|
254631
254642
|
return orig.call(inst, text)
|
|
254632
254643
|
}
|
|
254633
254644
|
}
|