feat: ajout support des alert
This commit is contained in:
parent
e4d9766b1c
commit
39f97567d6
2 changed files with 29 additions and 6 deletions
|
@ -14,6 +14,12 @@ const props = defineProps<{
|
|||
const htmlContent = ref("");
|
||||
const loadedPage = ref("");
|
||||
|
||||
var specialQuote: Map<string, { class: string; text: string }> = new Map();
|
||||
specialQuote.set("NOTE", { class: "info", text: "Information :" });
|
||||
specialQuote.set("SUCCESS", { class: "success", text: "Success :" });
|
||||
specialQuote.set("WARNING", { class: "warning", text: "Warning :" });
|
||||
specialQuote.set("DANGER", { class: "danger", text: "Danger :" });
|
||||
|
||||
var renderer = new marked.Renderer();
|
||||
|
||||
const toc = useTocStore();
|
||||
|
@ -33,6 +39,23 @@ renderer.heading = function (text, level, raw) {
|
|||
return `<h${level} id="${anchor}">${text}</h${level}>\n`;
|
||||
};
|
||||
|
||||
renderer.blockquote = function (quote) {
|
||||
console.log(quote);
|
||||
var bqClass = "";
|
||||
var newQuote = quote;
|
||||
for (const [key, quoteData] of specialQuote) {
|
||||
if (quote.includes(`[!${key}]`)) {
|
||||
bqClass = `bg-${quoteData?.class}`;
|
||||
newQuote = newQuote.replace(
|
||||
`[!${key}]`,
|
||||
`<strong>${quoteData?.text}</strong>`
|
||||
);
|
||||
}
|
||||
}
|
||||
newQuote = newQuote.replace("\n", "<br />");
|
||||
return `<blockquote class="${bqClass}">${newQuote}</blockquote>`;
|
||||
};
|
||||
|
||||
marked.setOptions({
|
||||
renderer: renderer,
|
||||
});
|
||||
|
|
|
@ -15,12 +15,12 @@ $whiteness_value: 0.8;
|
|||
|
||||
$palette: (
|
||||
"brown":#876445,
|
||||
"blue":#339af0,
|
||||
"violet":#845ef7,
|
||||
"red":#e33d22,
|
||||
"orange":#ff922b,
|
||||
"green":#51cf66,
|
||||
"skyblue":#3bc9db,
|
||||
"blue":#1c7ed6,
|
||||
"violet":#6741d9,
|
||||
"red":#e03131,
|
||||
"orange":#e67700,
|
||||
"green":#37b24d,
|
||||
"skyblue":#1098ad,
|
||||
"dark": #343a40,
|
||||
"light":#fefefe,
|
||||
"yellow":#fcc419,
|
||||
|
|
Loading…
Reference in a new issue