nuthrash / obsidian-html-plugin

This is a plugin for Obsidian (https://obsidian.md). Can open document with .html and .htm file extensions.
MIT License
127 stars 2 forks source link
htm html obsidian-plugin

Obsidian HTML reader Plugin

This is a plugin for Obsidian (https://obsidian.md). Can open document with .html and .htm file extensions.

How to use

  1. Put .html or .htm files to any obsidian-html-plugin installed vault folder
  2. Click any HTML or HTM item to open it
  3. Reading

Install this plugin from Obsidian

  1. Head to ⚙"Settings" ⇨ "Community plugins" options page, make sure "Restricted mode" is turned off.
  2. Click Browse button to open Community plugins browsing dialog.
  3. Search for this plugin "HTML Reader" and click the corresponding result item.
  4. Click Install button to install this plugin.
  5. Once installed, click Enable button to enable this plugin.
  6. Or, enable this plugin "HTML Reader" from the "Installed plugins" list of "Community plugins" options page.

Manually installing the plugin

  1. Copy the main.js and manifest.json files from Releases list to your vault <path>/<to>/<vaultFolder>/.obsidian/plugins/obsidian-html-plugin/.
  2. Relaunch Obsidian.
  3. Head to ⚙"Settings" ⇨ "Community plugins" options page, make sure "Restricted mode" is turned off and enable this plugin "HTML Reader" from the "Installed plugins" list of "Community plugins" options page.

HTML Reader Settings

  1. Head to ⚙"Settings" ⇨ "Community plugins" options page, find the settings icon ⚙ of "HTML Reader" item, then click it.
  2. Or, Head to ⚙"Settings" ⇨ click "HTML Reader" item on the bottom of left panel under the "Community plugins" group after enabled it.

HtmlReadedSettings1.jpg

General Settings

Operating Mode

Set Operating Mode for this plugin to protect user and app.

Comparsion
Images Styles Scripting DSD* CSP# HTML Sanitization Isolated
Text Mode No No No Yes Yes Yes Yes
High Restricted Mode Yes[1] Partial No Yes Yes Yes Yes
Balance Mode Yes Yes No Yes Yes Yes Yes
Low Restricted Mode Yes Yes Partial[2] Yes No No Yes
Unrestricted Mode Yes Yes Yes[3] Yes No No Yes

*: Declarative Shadow DOM

: Content Security Policy

[1]: The external image sources would be blocked by CSP.
[2]: The script codes inside <script> and external script files are still not executable.
[3]: The external script files may not executable due to Obsidian's limitation.

Detail Explanation
1. **Text Mode** - Highly recommended for the files came from untrusted source! This mode almost sanitized all visual effects, script codes, and styles out. eanwhile, it keeps text parts for reading the content of HTML files with HTML layout elements. 2. **High Restricted Mode** - This mode recommended for the user who wants more security. It would keep custom elements but sanitize unsafe HTML elements out, as well as unsafe attributes and their contents. The external image sources would be blocked by CSP, and the images are only available from the HTML files themselves. 3. **Balance Mode** - This mode is the default mode for this plugin. It would keep all custom elements and HTML elements, but sanitize unsafe attributes and their contents out. 4. **Low Restricted Mode** - This mode would not sanitize anything, all elements and their content would be keeped. The script codes inside ` Githubissues.
  • Githubissues is a development platform for aggregating issues.