wormi4ok / evernote2md

Convert Evernote .enex files to Markdown

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Special characters are being escaped by a backslash

qadzek opened this issue Β· comments

commented

Thanks a lot for creating this very useful tool. You helped me liberate my notes πŸ˜ƒ

I noticed however that a lot of special characters are being escaped by a backslash. I am using version 0.19.0.

E.g. for this short note in Evernote:

(parentheses) <angle> [square]
5 + 4 - 3
#hashtag bang! *star under_score

I receive this as output

\(parentheses\) \<angle\> \[square\]

5 \+ 4 \- 3

\#hashtag bang\! \*star under\_score

I wrote a little script to solve this problem, maybe it could help someone else:

#!/usr/bin/env bash

shopt -s globstar

for file in notes/**/*.md; do
  printf '%s\n' "$file"
  sed -i -e 's/\\-/-/g' \
    -e 's/\\(/(/g' \
    -e 's/\\)/)/g' \
    -e 's/\\_/_/g' \
    -e 's/\\+/+/g' \
    -e 's/\\#/#/g' \
    -e 's/\\!/!/g' \
    -e 's/\\\*/*/g' \
    -e 's/\\</</g' \
    -e 's/\\>/>/g' "$file"
done

Hi @infinitewhileloop ! Thanks for sharing your solution!
These special characters are escaped indeed, to ensure that the resulting Markdown can be rendered correctly. I gave an example in another issue #55 (comment) .

It really depends on what result is more valuable - raw files in Markdown format or rendered Markdown text. I guess it is a good candidate to become a cli flag in the newer version. πŸ‘πŸ»

Here you go - the new release v0.21.0 does not escape special characters by default! πŸŽ‰