mirror of
https://github.com/mat-1/matdoesdev.git
synced 2025-08-02 06:36:04 +00:00
remove empty comments from blog post json
This commit is contained in:
parent
dd419eee02
commit
812fd9ac0f
1 changed files with 3 additions and 1 deletions
|
@ -95,7 +95,9 @@ export async function getPost(slug: string): Promise<BlogPost | null> {
|
|||
// console.log('renderHtml', renderHtml)
|
||||
|
||||
// HACK: sveltekit adds garbage around the content, we just want what's in the article tag
|
||||
const html = /<article.*?>([\w\W]+)(?:<!---->)<\/article>/.exec(renderHtml.body)?.[1] ?? ''
|
||||
let html = /<article.*?>([\w\W]+)(?:<!---->)<\/article>/.exec(renderHtml.body)?.[1] ?? ''
|
||||
// sveltekit also adds random empty comments like "<!---->", we don't want those
|
||||
html = html.replace(/<!---->/g, '')
|
||||
|
||||
const css = Array.from(result.css)
|
||||
.map((css) => css.code)
|
||||
|
|
Loading…
Add table
Reference in a new issue