From ec88a0354dbd06ebc57cdd83a250d67b113ecce1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Raphael=20H=C3=B6ser?= Date: Thu, 30 Jun 2022 22:03:55 +0200 Subject: [PATCH] #92 Fix trailing \r for toml on windows --- index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.js b/index.js index 7d49331..7f50f75 100644 --- a/index.js +++ b/index.js @@ -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 === '') {