Skip to content

Commit

Permalink
Merge pull request #5 from 0x6b/fix-1
Browse files Browse the repository at this point in the history
feat: support img tag
  • Loading branch information
0x6b authored Jul 28, 2018
2 parents 15d24f4 + ddd6336 commit 98afc98
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
Binary file not shown.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "copy-selection-as-markdown",
"version": "0.1.1",
"version": "0.2.0",
"scripts": {
"web-ext": "web-ext",
"watch:webextension": "unset WEB_EXT_API_KEY WEB_EXT_API_SECRET && web-ext --browser-console --start-url https://developer.mozilla.org/en-US/Add-ons/WebExtensions/web-ext_command_reference --source-dir dist --artifacts-dir dist/web-ext-artifacts run",
"watch:webextension": "unset WEB_EXT_API_KEY WEB_EXT_API_SECRET && web-ext --browser-console --start-url https://developer.mozilla.org/en-US/Add-ons/WebExtensions/web-ext_command_reference --start-url https://www.mozilla.org/en-US/contribute/ --source-dir dist --artifacts-dir dist/web-ext-artifacts run",
"watch:js": "webpack --watch --progress",
"watch:assets": "cpx 'src/{icons/*,manifest.json}' dist --watch",
"prewatch": "npm-run-all generate-icons",
Expand Down
9 changes: 9 additions & 0 deletions src/lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ const getSelectionAsMarkdown = () => {
}
}

for (let img of container.getElementsByTagName("img")) {
if (!img.getAttribute("src").startsWith("http")) {
img.setAttribute(
"src",
url.resolve(document.URL, img.getAttribute("src"))
);
}
}

html = container.innerHTML;
}

Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Copy Selection as Markdown",
"version": "0.1.1",
"version": "0.2.0",
"description": "Copy title, URL, and selection as Markdown",
"icons": {
"48": "icons/default.svg",
Expand Down

0 comments on commit 98afc98

Please sign in to comment.