From 69598b11ab796fd83d28bf58e7995d4f5f134200 Mon Sep 17 00:00:00 2001 From: Lee Hanken Date: Fri, 12 Jul 2024 12:25:41 +0100 Subject: [PATCH] Neaten Medium avatar --- url_to_markdown_common_filters.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/url_to_markdown_common_filters.js b/url_to_markdown_common_filters.js index 175cc85..8422088 100755 --- a/url_to_markdown_common_filters.js +++ b/url_to_markdown_common_filters.js @@ -31,7 +31,7 @@ module.exports = { find: /\n(.+)\n\-{32,}\n/ig, replacement: (match, title) => { return '\n'+title+'\n'+'-'.repeat(title.length)+'\n' - } + } } ] @@ -43,6 +43,12 @@ module.exports = { find: '(https://miro.medium.com/max/60/', replacement: '(https://miro.medium.com/max/600/' } + ], + replace: [ + { + find: /\s*\[\s*!\[([^\]]+)\]\(([^\)]+)\)\s*\]\((https:\/\/medium.com\/@[^\?\)]*)\?[^\)]*\)\s*/g, + replacement: '![$1]($2)\n[$1]($3)\n\n' + } ] }, { @@ -51,7 +57,7 @@ module.exports = { /\* +Links(.|\r|\n)*Three +\|/g ] } - ], + ], filter: function (url, data, ignore_links=false) { let domain=''; @@ -60,10 +66,10 @@ module.exports = { url = new URL(url); if (url) { base_address = url.protocol+"//"+url.hostname; - domain = url.hostname; + domain = url.hostname; } } - + for (let i=0;i