new functions and js v=
This commit is contained in:
+7
-11
@@ -1,5 +1,7 @@
|
||||
import { EMOJI_SHORTCODES } from "@rustpad/emoji-data";
|
||||
|
||||
function escapeHtml(value) {
|
||||
return String(value).replace(/[&<>"']/g, c => ({"&":"&","<":"<",">":">",'"':""","'":"'"}[c]));
|
||||
return String(value).replace(/[&<>"']/g, c => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }[c]));
|
||||
}
|
||||
|
||||
function safeUrl(value) {
|
||||
@@ -8,13 +10,7 @@ function safeUrl(value) {
|
||||
return "#";
|
||||
}
|
||||
|
||||
const emoji = {
|
||||
smile:"😄", joy:"😂", heart:"❤️", thumbs_up:"👍", thumbsup:"👍", thumbs_down:"👎",
|
||||
fire:"🔥", rocket:"🚀", tada:"🎉", warning:"⚠️", white_check_mark:"✅", x:"❌",
|
||||
eyes:"👀", bulb:"💡", memo:"📝", pushpin:"📌", bug:"🐛", sparkles:"✨",
|
||||
thinking:"🤔", clap:"👏", ok_hand:"👌", pray:"🙏", muscle:"💪", coffee:"☕",
|
||||
tent:"⛺", star:"⭐", checkered_flag:"🏁"
|
||||
};
|
||||
const emoji = EMOJI_SHORTCODES;
|
||||
|
||||
function inline(value) {
|
||||
const tokens = [];
|
||||
@@ -146,7 +142,7 @@ function renderList(lines, start, lineOffset = 0, baseIndent = null, forcedType
|
||||
}
|
||||
|
||||
const classAttr = hasTask ? ` class="contains-task-items"` : "";
|
||||
return {html: `<${type}${classAttr}>${body}</${type}>`, end: index};
|
||||
return { html: `<${type}${classAttr}>${body}</${type}>`, end: index };
|
||||
}
|
||||
|
||||
function splitTableRow(line) {
|
||||
@@ -190,7 +186,7 @@ function collectHeadings(lines) {
|
||||
const count = used.get(base) || 0;
|
||||
used.set(base, count + 1);
|
||||
const id = count ? `${base}-${count + 1}` : base;
|
||||
headings.push({level: match[1].length, text: match[2], id, index});
|
||||
headings.push({ level: match[1].length, text: match[2], id, index });
|
||||
});
|
||||
return headings;
|
||||
}
|
||||
@@ -228,7 +224,7 @@ export function renderMarkdown(source, lineOffset = 0) {
|
||||
lines[i] = "";
|
||||
}
|
||||
|
||||
const closeList = () => {};
|
||||
const closeList = () => { };
|
||||
const closeCode = () => {
|
||||
const body = escapeHtml(code.join("\n"));
|
||||
const lang = normalizeLanguage(language);
|
||||
|
||||
Reference in New Issue
Block a user