Skip to content

Obsidian plugin: copy document as HTML, including images

License

Notifications You must be signed in to change notification settings

jkunczik/obsidian-copy-as-html

 
 

Repository files navigation

Copy Document as HTML

Plugin for Obsidian that copies the current document to the clipboard, so it can be pasted into HTML aware application like gmail.

This plugin exposes the Copy document as HTML: Copy the current document to clipboard command, which can be bound to a keyboard shortcut.

image

Features

Simple styling is applied to the document.

Currently working with :

  • ✅ images
  • ✅ plantuml
  • ✅ diagrams
  • ✅ obsidian-tasks
  • ✅ obsidian-dataview - for large dataview blocks the content may not be complete
  • ✅ Excalidraw - rendering as bitmap solves pasting in gmail
  • ✅ Mermaid

Advanced

  • You may choose whether you want to embed external links (http, https) or not. If you don't (default), you will need internet access to view the document, and the linked image may be taken offline. If you do your documents will be larger.
  • It is possible to customize or replace the stylesheet in the settings dialog.
  • The default is to convert SVG to bitmap for better compatibility at the cost of potential quality loss. If you know that you are pasting into an application with good .svg support, you can disable the Convert SVG to bitmap setting.
  • It is possible to render code and callouts to HTML tables. This makes them ugly except in Google Docs where they make the document slightly prettier.

Implementation

The plugin converts image references to data urls, so no references to the vault are included in the HTML.

Known issues

  • No mobile support
  • Special fields (double-colon attributes, ...) are not removed. (front-matter is)
  • data-uris can use a lot of memory for big/many pictures

Install

Look for Copy document as HTML in the community plugin section in the Obsidian settings.

Don't be afraid to comment if anything seems wrong !

Development

Please see the Obsidian sample plugin.

Credits

  • Oliver Balfour for his obsidian-pandoc plugin, which helped me solve some rendering issues.
  • TfTHacker for his BRAT plugin which makes beta-testing a breeze.
  • PJ Eby for his Hot-reload plugins which makes plugin development fast and fun.

About

Obsidian plugin: copy document as HTML, including images

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 95.3%
  • JavaScript 4.2%
  • CSS 0.5%