1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-15 23:00:36 +02:00

Desktop, Cli: Fixes #2085: Fix escaping of title when generating a markdown link (#2456)

Previously a title with brackets was escaped incorrectly. The brackets were replaced by underscores.

The following title `title [square] (round)` looked like this:

[title _square_ _round_](:/c54794f53e5e4b1aa558699e255d5f95)

Now it looks like this:

[title \[square\] (round)](:/c54794f53e5e4b1aa558699e255d5f95)

fixes #2085
This commit is contained in:
Helmut K. C. Tessarek
2020-02-07 17:15:41 -05:00
committed by GitHub
parent 8cbb0d03e8
commit 3f23d8ed06
3 changed files with 21 additions and 1 deletions

View File

@ -9,6 +9,11 @@ const markdownUtils = {
return text.replace(/(\[|\]|\(|\))/g, '_');
},
// Titles for markdown links only need escaping for [ and ]
escapeTitleText(text) {
return text.replace(/(\[|\])/g, '\\$1');
},
escapeLinkUrl(url) {
url = url.replace(/\(/g, '%28');
url = url.replace(/\)/g, '%29');