Files
dealplustech/node_modules/@astrojs/prism/dist/highlighter.js
Kunthawat Greethong 6562a1748f fix: Fix product page syntax errors
1. Remove duplicate/broken code in product tables section
2. Fix PostCSS config for Tailwind 4
3. Add @tailwindcss/postcss dependency
4. Remove --production flag from Dockerfile (sharp required)

All fixes enable successful Docker build with favicon working.
2026-03-03 14:57:46 +07:00

37 lines
1002 B
JavaScript

import Prism from "prismjs";
import loadLanguages from "prismjs/components/index.js";
import { addAstro } from "./plugin.js";
const languageMap = /* @__PURE__ */ new Map([["ts", "typescript"]]);
function runHighlighterWithAstro(lang, code) {
if (!lang) {
lang = "plaintext";
}
let classLanguage = `language-${lang}`;
const ensureLoaded = (language) => {
if (language && !Prism.languages[language]) {
loadLanguages([language]);
}
};
if (languageMap.has(lang)) {
ensureLoaded(languageMap.get(lang));
} else if (lang === "astro") {
ensureLoaded("typescript");
addAstro(Prism);
} else {
ensureLoaded("markup-templating");
ensureLoaded(lang);
}
if (lang && !Prism.languages[lang]) {
console.warn(`Unable to load the language: ${lang}`);
}
const grammar = Prism.languages[lang];
let html = code;
if (grammar) {
html = Prism.highlight(code, grammar, lang);
}
return { classLanguage, html };
}
export {
runHighlighterWithAstro
};