From cecb343761c7c524b7c0a0184d8679c18964ee32 Mon Sep 17 00:00:00 2001 From: Akos Balasko Date: Wed, 17 Mar 2021 12:55:34 +0100 Subject: [PATCH] do not replace newlines --- package.json | 2 +- src/convert-html-to-md.ts | 2 +- test/data/test-intend-newlines.md | 16 ++++++++++++---- test/yarle-tests.ts | 5 ++--- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 2fce9881..fb3d7c00 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "yarle-evernote-to-md", - "version": "3.12.0", + "version": "3.12.2", "description": "Yet Another Rope Ladder from Evernote", "keywords": [ "evernote", diff --git a/src/convert-html-to-md.ts b/src/convert-html-to-md.ts index 769f5b23..6f84369d 100644 --- a/src/convert-html-to-md.ts +++ b/src/convert-html-to-md.ts @@ -43,7 +43,7 @@ export const convertHtml2Md = (yarleOptions: YarleOptions, { htmlContent }: Note const contentNode = new JSDOM(content).window.document .getElementsByTagName('en-note').item(0) as any as HTMLElement; let contentInMd = getTurndownService(yarleOptions).turndown(fixSublists(contentNode)); - const newLinePlaceholder = new RegExp(`${EOL}?`, 'g'); + const newLinePlaceholder = new RegExp('', 'g'); contentInMd = contentInMd.replace(newLinePlaceholder,''); return contentInMd && contentInMd !== 'undefined' ? { content: contentInMd } : {content: ''}; }; diff --git a/test/data/test-intend-newlines.md b/test/data/test-intend-newlines.md index 7d662b62..dd054711 100644 --- a/test/data/test-intend-newlines.md +++ b/test/data/test-intend-newlines.md @@ -1,4 +1,12 @@ # test -note with text only +--- + + + Created at: 2018-10-06T09:43:49+01:00 + Updated at: 2018-10-06T09:44:11+01:00 + Notebook: test-intend-newlines + +--- line 1 @@ -8,11 +16,11 @@ line 5 level 1 - level 2 - level 3 - level 2 + level 2 + level 3 + level 2 - Created at: 2018-10-06T09:43:49+01:00 Updated at: 2018-10-06T09:44:11+01:00 + Notebook: test-intend-newlines diff --git a/test/yarle-tests.ts b/test/yarle-tests.ts index 0f6c4553..19632703 100644 --- a/test/yarle-tests.ts +++ b/test/yarle-tests.ts @@ -660,9 +660,8 @@ export const yarleTests: Array = [ keepOriginalAmountOfNewlines: true, }, - testOutputPath: 'notes/test-justText/test -note with text only.md', - expectedOutputPath: '/data/test-indend-newlines.md', - testModifier: YarleTestModifierOptions.skip + testOutputPath: 'notes/test-intend-newlines/test -note with text only.md', + expectedOutputPath: '/data/test-intend-newlines.md', }, { name: 'hanging enex',