Skip to content

Commit

Permalink
Update export-HTML.md guide
Browse files Browse the repository at this point in the history
  • Loading branch information
timvink authored May 23, 2024
1 parent 0a7300b commit 5dd5c90
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions docs/how-to/export-HTML.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# Export to HTML

After enabling the `print-site` plugin in your `mkdocs.yml`, you will have your entire site combined into a single page. That allows you to create a standalone HTML page: a single self-contained file that has all images, styling and scripts embedded. This means you could send a site as an email attachment, a use case common within companies where deploying static sites might be more involved.
After enabling the `print-site` plugin in your `mkdocs.yml`, you will have your entire site combined into a single page.

In order to create a self-contained, standalone HTML file from the print page, we will need to embed images, CSS and javascript using [data URLs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs). We can do this quite easily using the [htmlark](https://github.com/BitLooter/htmlark) python package:
That allows you to create a standalone HTML page: a single self-contained file that has all images, styling and scripts embedded. This means you could send a site as an email attachment, a use case common within companies where deploying static sites might be more involved.
This works because all the resources the page uses, such images, stylesheets (CSS) and interactive elements (javascript) are embedded into in a single HTML file using [data URLs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs).

You can create a .html file export using your internet browser (f.e. save as > webpage, single page). You can also do this programmatically, for example using the [htmlark](https://github.com/BitLooter/htmlark) python package:

```shell
pip install http html5lib requests
pip install htmlark
pip install htmlark[http,parsers]
```

To create the export:

```shell
mkdocs build

cd site/

# when mkdocs.yml has use_directory_urls: true (the default)
Expand Down

0 comments on commit 5dd5c90

Please sign in to comment.