Skip to content

Instantly share code, notes, and snippets.

@bgrins
Last active February 26, 2024 04:00
Show Gist options
  • Star 37 You must be signed in to star a gist
  • Fork 10 You must be signed in to fork a gist
  • Save bgrins/5700426 to your computer and use it in GitHub Desktop.
Save bgrins/5700426 to your computer and use it in GitHub Desktop.
Reminder of how to export bookmarks from Chrome as text.
/*
Export bookmarks from Chrome as text.
Go to Bookmarks Manager->Organize->Export to HTML file.
Then open that file, open console and run this command:
*/
[].map.call(document.querySelectorAll("dt a"), function(a) {
return a.textContent + " - " + a.href
}).join("\n");
@nat70
Copy link

nat70 commented Feb 13, 2018

Wonderful.Thanks for the help!

@ajburley
Copy link

This really helped me, thanks!

@rajkundalia
Copy link

Super!

@Pretagonist
Copy link

[].map.call(document.querySelectorAll("dt a, h3"), function(a) {
   return ((a.href) ? "" : "\n### ") + a.textContent + ((a.href) ? " - " + a.href : " ###")
}).join("\n");

This modifixation will also write out folder names

@peteythepanda
Copy link

converted to bookmarklet:

javascript:(function() {
  var result = [].map.call(document.querySelectorAll("dt a, h3"), function(a) {
    return ((a.href) ? "" : "\n# ") + a.textContent + ((a.href) ? " - " + a.href : " #");
  }).join("\n");

  var textarea = document.createElement("textarea");
  textarea.value = result;
  document.body.appendChild(textarea);
  textarea.select();
  document.execCommand("copy");
  document.body.removeChild(textarea);
  alert("Content copied to clipboard!");
})();

copy and add this as a bookmark, click on the bookmark while html opened

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment