Skip to content

Commit

Permalink
🐛 Correctly parse title in body
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Nov 22, 2022
1 parent c59e0b5 commit ca40c9d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ const parseNoteFile = async (dirName: string, year: string, file: string): Promi
? attributes.description
: "summary" in attributes && typeof attributes.summary === "string"
? attributes.summary
: body.substring(body.indexOf(title))?.trim();
: body.indexOf(title) > -1
? body.substring(body.indexOf(title) + title.length)?.trim() ?? body.trim()
: body.trim();

return {
slug: file,
Expand Down

0 comments on commit ca40c9d

Please sign in to comment.