The Trans Directory
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: add callout metadata parsing (#1172)

authored by

Alex Nordstrom and committed by
GitHub
77d6d962 9c726efa

+4 -3
+4 -3
quartz/plugins/transformers/ofm.ts
··· 123 123 const highlightRegex = new RegExp(/==([^=]+)==/, "g") 124 124 const commentRegex = new RegExp(/%%[\s\S]*?%%/, "g") 125 125 // from https://github.com/escwxyz/remark-obsidian-callout/blob/main/src/index.ts 126 - const calloutRegex = new RegExp(/^\[\!(\w+)\]([+-]?)/) 127 - const calloutLineRegex = new RegExp(/^> *\[\!\w+\][+-]?.*$/, "gm") 126 + const calloutRegex = new RegExp(/^\[\!(\w+)\|?(\w+)?\]([+-]?)/) 127 + const calloutLineRegex = new RegExp(/^> *\[\!\w+\|?\w*\][+-]?.*$/, "gm") 128 128 // (?:^| ) -> non-capturing group, tag should start be separated by a space or be the start of the line 129 129 // #(...) -> capturing group, tag itself must start with # 130 130 // (?:[-_\p{L}\d\p{Z}])+ -> non-capturing group, non-empty string of (Unicode-aware) alpha-numeric characters and symbols, hyphens and/or underscores ··· 427 427 428 428 const match = firstLine.match(calloutRegex) 429 429 if (match && match.input) { 430 - const [calloutDirective, typeString, collapseChar] = match 430 + const [calloutDirective, typeString, calloutMetaData, collapseChar] = match 431 431 const calloutType = canonicalizeCallout(typeString.toLowerCase()) 432 432 const collapse = collapseChar === "+" || collapseChar === "-" 433 433 const defaultState = collapseChar === "-" ? "collapsed" : "expanded" ··· 489 489 className: classNames.join(" "), 490 490 "data-callout": calloutType, 491 491 "data-callout-fold": collapse, 492 + "data-callout-metadata": calloutMetaData, 492 493 }, 493 494 } 494 495 }