Replace marked.min.js with the marked npm package and update all references accordingly.

This commit is contained in:
2026-03-19 12:28:14 +01:00
parent 2b8659499a
commit ff14061dfd
7 changed files with 23 additions and 157 deletions

View File

@@ -1,6 +1,8 @@
// popup.js
"use strict";
import { marked } from "marked";
// ── State ───────────────────────────────────────────────────────────────────
const state = {
markdown: "",
@@ -172,12 +174,7 @@ function sanitizeHtml(html) {
function renderPreview() {
state.markdown = mdEditor.value;
if (typeof marked !== "undefined") {
mdPreview.innerHTML = sanitizeHtml(marked.parse(state.markdown, { breaks: true }));
} else {
// Fallback: basic escaping
mdPreview.innerHTML = `<pre style="white-space:pre-wrap">${escHtml(state.markdown)}</pre>`;
}
mdPreview.innerHTML = sanitizeHtml(marked.parse(state.markdown, { breaks: true }));
}
function escHtml(s) {