diff --git a/core/syntaxHighlighting/SyntaxHighlighter.ts b/core/syntaxHighlighting/SyntaxHighlighter.ts index 3a3541d71..b05092913 100644 --- a/core/syntaxHighlighting/SyntaxHighlighter.ts +++ b/core/syntaxHighlighting/SyntaxHighlighter.ts @@ -193,30 +193,10 @@ export class SyntaxHighlighter { dimensions: Dimensions, options: ConversionOptions, ): Promise { - // const svg = ` - // ${guts} - // `; - - // const tempPage = await this.browser.newPage(); - // await tempPage.setContent(svg); - - // const dimensions = await tempPage.evaluate(() => { - // const svg = document.querySelector("svg"); - // if (!svg) return { width: 0, height: 0 }; - // const bbox = svg.getBBox(); - // return { - // width: Math.ceil(bbox.width), - // height: Math.ceil(bbox.height), - // }; - // }); - - // await tempPage.close(); - const svg = ` TEST TEXT THIS IS `; - console.log(svg); return Buffer.from(svg, "utf8"); } @@ -230,39 +210,20 @@ export class SyntaxHighlighter { ): Promise { const highlightedCodeHtml = await this.highlightCode(code, language); - // console.log(code); - // console.log(highlightedCodeHtml); - const guts = this.convertShikiHtmlToSvgGut( highlightedCodeHtml, fontSize, lineHeight, ); const backgroundColor = this.getBackgroundColor(highlightedCodeHtml); - // const svg = ` - // ${guts} - // `; - - // const tempPage = await this.browser.newPage(); - // await tempPage.setContent(svg); - - // const dimensions = await tempPage.evaluate(() => { - // const svg = document.querySelector("svg"); - // if (!svg) return { width: 0, height: 0 }; - // const bbox = svg.getBBox(); - // return { - // width: Math.ceil(bbox.width), - // height: Math.ceil(bbox.height), - // }; - // }); - - // await tempPage.close(); const svg = ` - ${guts} + + + ${guts} + `; - console.log(svg); return Buffer.from(svg, "utf8"); } @@ -303,6 +264,7 @@ export class SyntaxHighlighter { console.log(process.cwd()); return Buffer.from( await fs.readFile( + // TODO: fix this to actually resolve to path "/home/jacob/continue/continue/fonts/Cascadia_Mono/static/CascadiaMono-Regular.ttf", "binary", ), @@ -336,7 +298,6 @@ export class SyntaxHighlighter { .join(""); const y = (index + 1) * lineHeight; - // const y = index * lineHeight; return `${spans}`; });