Skip to content

Commit

Permalink
Merge pull request #21 from HiDeoo/hd-fix-obsidian-frontmatter-null-v…
Browse files Browse the repository at this point in the history
…alue
  • Loading branch information
HiDeoo authored Jun 4, 2024
2 parents dd6f214 + e70d0ac commit 3f360e3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions fixtures/basics/Supported properties.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
description: This is a custom description
permalink: custom-slug
aliases:
---

Test
12 changes: 7 additions & 5 deletions packages/starlight-obsidian/libs/obsidian.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,18 @@ const obsidianFrontmatterSchema = z.object({
aliases: z
.array(z.string())
.optional()
.nullable()
.transform((aliases) => aliases?.map((alias) => slug(alias))),
cover: z.string().optional(),
description: z.string().optional(),
image: z.string().optional(),
permalink: z.string().optional(),
cover: z.string().optional().nullable(),
description: z.string().optional().nullable(),
image: z.string().optional().nullable(),
permalink: z.string().optional().nullable(),
publish: z
.union([z.boolean(), z.literal('true'), z.literal('false')])
.optional()
.nullable()
.transform((publish) => publish === undefined || publish === 'true' || publish === true),
tags: z.array(z.string()).optional(),
tags: z.array(z.string()).optional().nullable(),
})

const imageFileFormats = new Set(['.avif', '.bmp', '.gif', '.jpeg', '.jpg', '.png', '.svg', '.webp'])
Expand Down

0 comments on commit 3f360e3

Please sign in to comment.