feat: codeblock highlighter and styling #9
|
@ -117,13 +117,7 @@ export default async function init(db: Postgres) {
|
|||
|
||||
for (const { path, id } of articleFiles) {
|
||||
const res = await db.query('select * from article where id = $1', [id]);
|
||||
const compiled = await compile(fs.readFileSync(path, 'utf-8'), {
|
||||
highlight: {
|
||||
highlighter: (code: string, lang: string) => {
|
||||
return `<Codeblock><code class="language-${lang}">${code}</code></Codeblock>`;
|
||||
}
|
||||
}
|
||||
});
|
||||
const compiled = await compile(fs.readFileSync(path, 'utf-8'), {});
|
||||
|
||||
const title = compiled.data.fm.title;
|
||||
const category = path.split('/')[3];
|
||||
|
|
Loading…
Reference in New Issue
Block a user