Skip to content

Commit

Permalink
Merge pull request #39 from timlrx/frontmatter
Browse files Browse the repository at this point in the history
Support both matter and frontmatter fields
  • Loading branch information
timlrx committed Aug 11, 2024
2 parents e96eb7c + 8e42df3 commit 9a5f746
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ const rehypeCitationGenerator = (Cite) => {
return async (tree, file) => {
/** @type {string[]} */
let bibtexFile = []
/** @type {string} */ // @ts-ignore
const inputCiteformat = options.csl || file?.data?.frontmatter?.csl || defaultCiteFormat
/** @type {string[] | false} */ // @ts-ignore
const noCite = options.noCite || file?.data?.frontmatter?.csl || false
const inputCiteformat =
/** @type {string} */ // @ts-ignore
options.csl || file?.data?.matter?.csl || file?.data?.frontmatter?.csl || defaultCiteFormat
const noCite =
/** @type {string[] | false} */ // @ts-ignore
options.noCite || file?.data?.matter?.noCite || file?.data?.frontmatter?.noCite || false
const inputLang = options.lang || 'en-US'
const config = Cite.plugins.config.get('@csl')
const citeFormat = await loadCSL(Cite, inputCiteformat, options.path)
Expand Down

0 comments on commit 9a5f746

Please sign in to comment.