feat: codeblock highlighter and styling #9

Merged
Hare merged 8 commits from develop into master 2024-09-07 02:49:35 +09:00
Showing only changes of commit dece9dfb79 - Show all commits

View File

@ -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];