diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-05-12 01:12:27 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-05-12 01:12:27 +0900 |
| commit | 9c5a5ca26a4b2cd7cef1eda65c06de14e45f56e3 (patch) | |
| tree | af57a0fff056806b230105f49197523a4d3f2485 | |
| parent | 21136ab8db7572c527726f93009b4b72bf00f9a9 (diff) | |
| download | nsfisis.dev-9c5a5ca26a4b2cd7cef1eda65c06de14e45f56e3.tar.gz nsfisis.dev-9c5a5ca26a4b2cd7cef1eda65c06de14e45f56e3.tar.zst nsfisis.dev-9c5a5ca26a4b2cd7cef1eda65c06de14e45f56e3.zip | |
fix(blog/nuldoc): fix parsing of frontmatter
| -rw-r--r-- | vhosts/blog/nuldoc-src/djot/parse.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/vhosts/blog/nuldoc-src/djot/parse.ts b/vhosts/blog/nuldoc-src/djot/parse.ts index 884ab154..c79a6708 100644 --- a/vhosts/blog/nuldoc-src/djot/parse.ts +++ b/vhosts/blog/nuldoc-src/djot/parse.ts @@ -15,9 +15,9 @@ export async function parseDjotFile( ): Promise<Document> { try { const fileContent = await Deno.readTextFile(filePath); - const parts = fileContent.split(/^---$/m); - const meta = parseMetadata(parts[1]); - const root = parseDjot(parts[2]); + const [, frontmatter, ...rest] = fileContent.split(/^---$/m); + const meta = parseMetadata(frontmatter); + const root = parseDjot(rest.join("\n")); const doc = createNewDocumentFromDjotDocument(root, meta, filePath, config); return await toHtml(doc); } catch (e) { |
