Skip to content

Commit

Permalink
Update to embed-resources
Browse files Browse the repository at this point in the history
  • Loading branch information
mine-cetinkaya-rundel authored Dec 5, 2024
1 parent 4084db4 commit 12a24ed
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions posts/09-self-contained/index.qmd
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
---
be---
title: "Self-contained HTML"
date: "2022-07-06"
categories: [html]
image: "featured.png"
image-alt: "YAML with format html and option self-contained set to true."
image-alt: "YAML with format html and option embed-resources set to true."
---

## `self-contained: true`
## `embed-resources: true`

If you want to create an entirely self-contained HTML document (with images, CSS, etc. embedded into the HTML file), add the following to the YAML of your document.

``` yaml
format:
html:
self-contained: true
embed-resources: true
```
This produces a standalone HTML with no external dependencies.
- This works with `.qmd` and `.ipynb` files.
- If instead of publishing the document, you want to share it using a file sharing service (e.g., Dropbox) or email it to someone just like you share other document types like spreadsheets, presentations, and PDFs, you should use this option to generate a self-contained HTML.
- If instead of publishing the document, you want to share it using a file-sharing service (e.g., Dropbox) or email it to someone just like you share other document types like spreadsheets, presentations, and PDFs, you should use this option to generate a self-contained HTML.
- Quarto presentations created with revealjs can also be published as self-contained HTML.
- Math libraries are not embedded in self-contained HTML documents by default (because they are quite large and often time consuming to download) but you can add `self-contained-math: true` to your YAML to embed them as well.
Math libraries are not embedded in self-contained HTML documents by default (because they are quite large and often time-consuming to download), but you can add `self-contained-math: true` to your YAML to embed them as well.

## Learn more

[Self-contained HTML](https://quarto.org/docs/output-formats/html-basics.html#self-contained)

::: callout-note
An earlier version of this post referred to `self-contained`. That YAML field has been deprecated and `embed-resources` should be used.
:::

0 comments on commit 12a24ed

Please sign in to comment.