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