Skip to content

Commit

Permalink
do not replace newlines
Browse files Browse the repository at this point in the history
  • Loading branch information
akosbalasko committed Mar 17, 2021
1 parent a626eff commit cecb343
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/convert-html-to-md.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}?<YARLE_NEWLINE_PLACEHOLDER>`, 'g');
const newLinePlaceholder = new RegExp('<YARLE_NEWLINE_PLACEHOLDER>', 'g');
contentInMd = contentInMd.replace(newLinePlaceholder,'');
return contentInMd && contentInMd !== 'undefined' ? { content: contentInMd } : {content: ''};
};
16 changes: 12 additions & 4 deletions test/data/test-intend-newlines.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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

5 changes: 2 additions & 3 deletions test/yarle-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -660,9 +660,8 @@ export const yarleTests: Array<YarleTest> = [
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',
Expand Down

0 comments on commit cecb343

Please sign in to comment.