Skip to content

Commit

Permalink
chore(callouts): remove unnecessary whitespaces after class name (jac…
Browse files Browse the repository at this point in the history
…kyzha0#833)

Though we should have a plugins that just strip whitespace in all node
class.

Signed-off-by: Aaron <[email protected]>
  • Loading branch information
aarnphm authored Feb 10, 2024
1 parent 6ae0bb0 commit ab80eba
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions quartz/plugins/transformers/ofm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -450,13 +450,19 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin<Partial<Options>
// replace first line of blockquote with title and rest of the paragraph text
node.children.splice(0, 1, ...blockquoteContent)

const classNames = ["callout", calloutType]
if (collapse) {
classNames.push("is-collapsible")
}
if (defaultState === "collapsed") {
classNames.push("is-collapsed")
}

// add properties to base blockquote
node.data = {
hProperties: {
...(node.data?.hProperties ?? {}),
className: `callout ${calloutType} ${collapse ? "is-collapsible" : ""} ${
defaultState === "collapsed" ? "is-collapsed" : ""
}`,
className: classNames.join(" "),
"data-callout": calloutType,
"data-callout-fold": collapse,
},
Expand Down

0 comments on commit ab80eba

Please sign in to comment.