diff --git a/examples/sections.js b/examples/sections.js index bc6a6f3..5b621ed 100644 --- a/examples/sections.js +++ b/examples/sections.js @@ -9,7 +9,7 @@ const str = fs.readFileSync(path.join(__dirname, 'fixtures', 'sections.md')); const file = matter(str, { section: function(section, file) { if (typeof section.data === 'string' && section.data.trim() !== '') { - section.data = yaml.safeLoad(section.data); + section.data = yaml.load(section.data); } section.content = section.content.trim() + '\n'; } diff --git a/lib/engines.js b/lib/engines.js index 38f993d..db024e9 100644 --- a/lib/engines.js +++ b/lib/engines.js @@ -13,7 +13,7 @@ const engines = exports = module.exports; */ engines.yaml = { - parse: yaml.safeLoad.bind(yaml), + parse: yaml.load.bind(yaml), stringify: yaml.safeDump.bind(yaml) }; diff --git a/package.json b/package.json index 3ddd1ef..4f71777 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "test": "mocha" }, "dependencies": { - "js-yaml": "^3.13.1", + "js-yaml": "^4.1.1", "kind-of": "^6.0.2", "section-matter": "^1.0.0", "strip-bom-string": "^1.0.0" diff --git a/test/parse-custom.js b/test/parse-custom.js index 14047eb..89e925a 100644 --- a/test/parse-custom.js +++ b/test/parse-custom.js @@ -16,7 +16,7 @@ describe('custom parser:', function() { var actual = matter.read('./test/fixtures/lang-yaml.md', { parser: function customParser(str, opts) { try { - return YAML.safeLoad(str, opts); + return YAML.load(str, opts); } catch (err) { throw new SyntaxError(err); } diff --git a/test/parse-yaml.js b/test/parse-yaml.js index 45bdc5c..49b3a06 100644 --- a/test/parse-yaml.js +++ b/test/parse-yaml.js @@ -53,9 +53,9 @@ describe('parse YAML:', function() { assert(actual.hasOwnProperty('orig')); }); - it('should use safeLoad when specified', function() { + it('should use load when specified', function() { var fixture = '---\nabc: xyz\nversion: 2\n---\n\nThis is an alert\n'; - var actual = matter(fixture, {safeLoad: true}); + var actual = matter(fixture, {load: true}); assert.deepEqual(actual.data, {abc: 'xyz', version: 2}); assert.equal(actual.content, '\nThis is an alert\n'); assert(actual.hasOwnProperty('orig'));