Based on @kepano's awesome original (thier readme below)
This version has an added feature to parse a site's <meta name="keywords" ...>
tag, if it exists, to automatically create tags for clippings. It might be a bit noisy in Graph View, but it also can save time in identifying related pages.
It also geneates YAML based front matter, which isn't entirely viewable in Reading Mode, but allows for tags including special characters like "#" and ".".
There is an issue with using this bookmarklet, or any bookmarklet, in Firefox on sites that implement a script-src
Content Security Policy (CSP). See https://bugzilla.mozilla.org/show_bug.cgi?id=866522 for details. If you run into this, Chrome might work for those sites, or you can try the MarkDownload browser extension, as @kepano mentions below.
By @kepano
🎉 Support my work at buymeacoffee.com/kepano
You can find a demo of this bookmarklet on YouTube
Create a new bookmark in your browser, then copy/paste the minified code below into the URL field.
You can customize the output using the optional variables at the top, and the template at the bottom. The default template is designed for use with the Dataview plugin. If you make changes I recommend using Bookmarklet Maker to minify and URI encode the bookmarklet.
By default, clicking the bookmarklet creates a new Obsidian file from the main body of the article (similar to Readability view). Alternatively you can choose to create a file from a selection, by either selecting all (CMD+A
), or just a portion of the page.
This bookmarklet may not work on all websites. If you run into issues, you can also try the MarkDownload browser extension which provides similar functionality. You can troubleshoot issues by opening the Developer Console in your browser and checking if any errors appear when you click the bookmarklet. The most common error is that a website or the browser itself is blocking third party code execution. Unfortunately there is no good solve for that yet.
Nice code and thanks for the work
You shoud probably add a "/" between the folder and the filemame when creating the final url. It will be less confusing
+ "file=" + encodeURIComponent(folder + "/" + fileName)