-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Repair backwards compatibility https://github.com/nodeca/js-yaml/blob/master/migrate_v3_to_v4.md with a bunch of plugins that use these yaml tags. e.g.: https://github.com/lavas-project/hexo-pwa#options uses these yaml tags in the routes `!!js/regexp`
- Loading branch information
1 parent
4c4bd22
commit 7808bec
Showing
2 changed files
with
6 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
'use strict'; | ||
"use strict"; | ||
|
||
const yaml = require('js-yaml'); | ||
const { escape } = require('hexo-front-matter'); | ||
const yaml = require("js-yaml"); | ||
const { escape } = require("hexo-front-matter"); | ||
const schema = yaml.DEFAULT_SCHEMA.extend(require("js-yaml-js-types").all); | ||
|
||
function yamlHelper(data) { | ||
return yaml.load(escape(data.text)); | ||
return yaml.load(escape(data.text), { schema }); | ||
} | ||
|
||
module.exports = yamlHelper; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters