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

Clipper: Download images and convert them to resources

This commit is contained in:
Laurent Cozic
2018-05-23 12:14:38 +01:00
parent 7cf267254f
commit 3c5eb99c59
15 changed files with 1355 additions and 1158 deletions

View File

@ -0,0 +1,24 @@
const urlUtils = require('lib/urlUtils');
const markdownUtils = {
// Not really escaping because that's not supported by marked.js
escapeLinkText(text) {
return text.replace(/(\[|\]|\(|\))/g, '_');
},
escapeLinkUrl(url) {
url = url.replace(/\(/g, '%28');
url = url.replace(/\)/g, '%29');
return url;
},
prependBaseUrl(md, baseUrl) {
return md.replace(/(\]\()([^\s\)]+)(.*?\))/g, (match, before, url, after) => {
return before + urlUtils.prependBaseUrl(url, baseUrl) + after;
});
},
};
module.exports = markdownUtils;