svg preview renderer
This commit is contained in:
parent
43a8412f06
commit
faa9599849
29 changed files with 1027 additions and 254 deletions
|
|
@ -9,11 +9,10 @@ const CodeBlockHook = {
|
|||
this.el.dataset.highlightedLines || "[]",
|
||||
);
|
||||
|
||||
console.log(code);
|
||||
console.log("language", language);
|
||||
|
||||
const lines = code.split("\n");
|
||||
|
||||
console.log(lines.length, lines);
|
||||
|
||||
// Convert line numbers to decorations
|
||||
const decorations = highlightedLines
|
||||
.map((line) => {
|
||||
|
|
@ -40,7 +39,16 @@ const CodeBlockHook = {
|
|||
codeToHtml(code, {
|
||||
lang: language,
|
||||
theme: "catppuccin-mocha",
|
||||
decorations,
|
||||
transformers: [
|
||||
{
|
||||
line(node, line) {
|
||||
node.properties["data-line"] = line;
|
||||
if (highlightedLines.includes(line)) {
|
||||
this.addClassToHast(node, "highlighted");
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
}).then((html) => {
|
||||
console.log(html);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue