-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4084db4
commit 12a24ed
Showing
1 changed file
with
10 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
::: |