Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/sections.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
Expand Down
4 changes: 2 additions & 2 deletions lib/engines.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ const engines = exports = module.exports;
*/

engines.yaml = {
parse: yaml.safeLoad.bind(yaml),
stringify: yaml.safeDump.bind(yaml)
parse: yaml.load.bind(yaml),
stringify: yaml.dump.bind(yaml)
};

/**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"test": "mocha"
},
"dependencies": {
"js-yaml": "^3.13.1",
"js-yaml": "^4.1.0",
"kind-of": "^6.0.2",
"section-matter": "^1.0.0",
"strip-bom-string": "^1.0.0"
Expand Down
2 changes: 1 addition & 1 deletion test/parse-custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions test/parse-yaml.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ describe('parse YAML:', function() {
assert(actual.hasOwnProperty('orig'));
});

it('should use safeLoad when specified', function() {
it('should use safe by default', function() {
var fixture = '---\nabc: xyz\nversion: 2\n---\n\n<span class="alert alert-info">This is an alert</span>\n';
var actual = matter(fixture, {safeLoad: true});
var actual = matter(fixture);
assert.deepEqual(actual.data, {abc: 'xyz', version: 2});
assert.equal(actual.content, '\n<span class="alert alert-info">This is an alert</span>\n');
assert(actual.hasOwnProperty('orig'));
Expand Down