Embed HTML files in your published Digital Garden notes

1 hour ago

Digital Garden version 2.102.0 lets you publish HTML files inside your notes. Embed one the way you would embed an image, and when you publish, your garden shows that page in a frame, running its own scripts and styles. This release adds that one feature, with nothing to migrate.

Ask about this presentation

Chapters

  1. 0:00HTML files embed in your notes
  2. 0:19Embed it like an image
  3. 0:42The page runs and the frame fits it
  4. 1:05Add a number for a fixed height
  5. 1:25Only the HTML file is published
  6. 1:48Embed a page from another website
  7. 2:07Update to 2.102.0
Show transcript
  1. Digital Garden version 2.102.0 lets you publish HTML files inside your notes. Embed one the way you would embed an image, and when you publish, your garden shows that page in a frame, running its own scripts and styles. This release adds that one feature, with nothing to migrate.

    Slide text
    Digital Garden logo

    Version 2.102.0

    Embed HTML files in your published Digital Garden notes

    ![[page.html]]
  2. Both link styles work. There is the double-bracket wikilink, with an exclamation mark in front, just like an image embed. Or there is the standard Markdown image link, pointing at the file's path. Files ending in .htm count too. Inside Obsidian, plugins like Embed HTML already show these files in a frame, and now your published garden shows them the same way.

    Slide text
    Wikilink ![[page.html]]
    Markdown ![](page.html)

    Files ending in .html or .htm

  3. Here is a small example from the plugin's own repository, a click counter. Its style block and its script sit inside the file, and both run on your garden. The frame is not sandboxed, because this is your own file, served from your own site. The frame starts at 500 pixels. Once the page loads, it measures it, and it keeps resizing whenever the content grows or shrinks.

    Slide text

    The page runs, and the frame grows to fit it

    500 px until it loads, then sized to the page

    counter.html

    <style>
      button { font-size: 1rem; }
    </style>
    <p>… Clicked <span id="count">0</span> times.</p>
    <button id="increment">Click me</button>
    <script>
      let count = 0;
      …addEventListener("click", () => {
        count += 1;
        …
      });
    </script>
  4. Want a fixed size instead? Put a number after a pipe, and that number becomes the frame's height in pixels. Any other text before it becomes the frame's title. So this line embeds the counter, titled Click counter, at 200 pixels tall. With a fixed height, the frame no longer resizes itself.

    Slide text
    ![[page.html|600]]

    600 pixels tall

    ![[counter.html|Click counter|200]]

    Title, then height

  5. Only the HTML file itself gets published. If it loads a stylesheet, a script or an image from a file next to it, that file stays behind, so keep your CSS, JavaScript and images inline. The plugin checks for this when you publish, and shows a notice naming up to three of those files. And a file over 20 megabytes gets a plain link instead of an embed.

    Slide text

    Only the HTML file itself is published

    Keep CSS, JavaScript and images inside the file

    page.html references files that are not published with it (style.css). Only self-contained HTML files display fully on the garden.

    Files over 20 MB publish as a link

  6. You can also embed a page from another website, using a Markdown image link to its full address. That page isn't uploaded to your garden. It loads in a sandboxed frame that stops it from sending your visitors away from the garden. And because a page on another site can't be measured, it stays at a fixed 500 pixels.

    Slide text
    ![Demo](https://example.com/page.html)

    Not uploaded

    Loads from its own site

    Sandboxed

    Can't navigate visitors away

    500 px tall

    Fixed height

  7. So, should you update? This release adds one feature and has no migration steps, and the minimum Obsidian version stays at 1.10.0. If your HTML pages load files that sit beside them, fold those into the page before you publish, so the page displays fully. Update the Digital Garden plugin, and your notes can carry HTML pages onto your garden.

    Slide text

    It needs no migration, and Obsidian 1.10.0 is still the minimum.

    Inline the files your HTML pages load before you publish

What happened in AI today, in your inbox

One short email each evening. Read it and you’re caught up.

Built in New York with ❤️