feat(comments): support true string values for comments

This commit is contained in:
David Fischer 2024-11-04 21:55:43 +01:00
parent 2aac704812
commit b36f389eb8
No known key found for this signature in database
GPG Key ID: F21F2016DEFEC73D
2 changed files with 4 additions and 1 deletions

View File

@ -28,7 +28,9 @@ function boolToStringBool(b: boolean): string {
export default ((opts: Options) => {
const Comments: QuartzComponent = ({ displayClass, fileData, cfg }: QuartzComponentProps) => {
// check if comments should be displayed according to frontmatter
if ((opts.respectFrontmatter ?? false) && !(fileData.frontmatter?.comments ?? false)) {
const commentsFlag: boolean =
fileData.frontmatter?.comments === true || fileData.frontmatter?.comments === "true"
if ((opts.respectFrontmatter ?? false) && !commentsFlag) {
return null
}

View File

@ -93,6 +93,7 @@ declare module "vfile" {
lang: string
enableToc: string
cssclasses: string[]
comments: boolean | string
}>
}
}