Last active
May 11, 2020 23:34
-
-
Save raphaelrk/99dadcbc6de542bce9480c7d4e6d25ea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* How to do markdown export, i.e. [Title](URL), in tabsave | |
* 1. Download the project from https://github.com/raphaelrk/tabsave | |
* 2. Change the following code in script.js (https://github.com/raphaelrk/tabsave/blob/master/script.js) | |
**/ | |
// old code | |
return tabs.map(tab => (` | |
${tab.title} | |
<br> | |
<a href="${escapeHtml(tab.url)}">${escapeHtml(tab.url)}</a> | |
`)).join("<br>"); | |
// new code | |
function escapeMarkdown(str) { | |
return str | |
.replace(/\[/g, "\\[") | |
.replace(/\]/g, "\\]") | |
.replace(/\(/g, "\\(") | |
.replace(/\)/g, "\\)") | |
} | |
return tabs.map(tab => `[${escapeMarkdown(tab.title)}](${escapeMarkdown(escapeHtml(tab.url)}))]`); | |
/** | |
* 3. Load the extension by going to chrome://extensions, | |
* turning on developer, pressing "load unpacked", then selecting the folder | |
**/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment