Skip to content

Commit

Permalink
jonschlinkert#92 Fix trailing \r for toml on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Snapstromegon committed Jun 30, 2022
1 parent a5726b0 commit ec88a03
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ function parseMatter(file, options) {

// get the raw front-matter block
file.matter = str.slice(0, closeIndex);
// fix trailing '\r' on windows
if (file.matter.endsWith('\r')) {
file.matter = file.matter.slice(0, -1);
}

const block = file.matter.replace(/^\s*#[^\n]+/gm, '').trim();
if (block === '') {
Expand Down

0 comments on commit ec88a03

Please sign in to comment.