Skip to content

Commit

Permalink
Change to use yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Sep 22, 2023
1 parent d033a70 commit 8d5595f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @typedef {import('unified').Processor<undefined, undefined, undefined, Root>} Processor
*/

import jsYaml from 'js-yaml'
import yaml from 'yaml'

/**
* Configure remark with YAML frontmatter.
Expand All @@ -24,7 +24,8 @@ export default function remarkYamlConfig() {
handlers: {
/** @param {Yaml} node */
yaml(node, _, state) {
const data = jsYaml.load(node.value)
/** @type {unknown} */
const data = yaml.parse(node.value)
const config =
data && typeof data === 'object' && 'remark' in data
? data.remark
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
],
"dependencies": {
"@types/mdast": "^4.0.0",
"js-yaml": "^4.0.0",
"unified": "^11.0.0"
"unified": "^11.0.0",
"yaml": "^2.0.0"
},
"devDependencies": {
"@types/node": "^20.0.0",
Expand Down

0 comments on commit 8d5595f

Please sign in to comment.