chiltepin-render 0.34.1 → 0.34.2
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.js +6 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3114,11 +3114,16 @@ var TY = new Set(
|
|
|
3114
3114
|
);
|
|
3115
3115
|
var TOKEN_RE = /(\/\*[\s\S]*?\*\/|\/\/[^\n]*|#[^\n]*)|("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|`(?:\\.|[^`\\])*`)|(\b\d[\w.]*)|([A-Za-z_$][\w$]*)/g;
|
|
3116
3116
|
var MD_LANGS = /* @__PURE__ */ new Set(["md", "markdown", "mdx"]);
|
|
3117
|
+
var PLAIN_LANGS = /* @__PURE__ */ new Set(["text", "txt", "plain", "plaintext", "prompt", "none"]);
|
|
3117
3118
|
function highlightCode(code, lang) {
|
|
3118
3119
|
if (code.length === 0) return "";
|
|
3119
|
-
|
|
3120
|
+
const label = lang?.trim().toLowerCase();
|
|
3121
|
+
if (label !== void 0 && MD_LANGS.has(label)) {
|
|
3120
3122
|
return highlightMarkdown(String(code));
|
|
3121
3123
|
}
|
|
3124
|
+
if (label !== void 0 && PLAIN_LANGS.has(label)) {
|
|
3125
|
+
return escapeHtml(String(code));
|
|
3126
|
+
}
|
|
3122
3127
|
const src = String(code);
|
|
3123
3128
|
let out = "";
|
|
3124
3129
|
let last = 0;
|