diff --git a/README.md b/README.md
index 9b9fb62498..2b631d9d54 100644
--- a/README.md
+++ b/README.md
@@ -12,6 +12,7 @@ The theme is a fork of the great [Learn theme](https://github.com/matcornic/hugo
- Usable offline, no external dependencies
- Automatic Search
+- Print whole chapters or even the complete site
- Multilingual mode for English, Arabic, Simplified Chinese, Dutch, French, German, Hindi, Indonesian, Japanese, Korean, Portuguese, Russian, Spanish, Vietnamese, Turkish
- Unlimited menu levels
- Automatic next/prev buttons to navigate through menu entries
diff --git a/config.toml b/config.toml
index 28af7b764d..bdbf019168 100644
--- a/config.toml
+++ b/config.toml
@@ -1,3 +1,12 @@
[module]
[module.hugoVersion]
min = "0.93.0"
+
+[outputFormats]
+ [outputFormats.PRINT]
+ name= "PRINT"
+ baseName = "index"
+ path = "_print"
+ isHTML = true
+ mediaType = 'text/html'
+ permalinkable = false
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 2ffcf7e1f6..cb92d7be3b 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -43,9 +43,13 @@ title = "Hugo Relearn Documentation"
mermaidInitialize = "{ \"securityLevel\": \"loose\" }"
[outputs]
- # add JSON to the home page to support lunr search; This is a mandatory setting
+ # add JSON to the home to support lunr search; This is a mandatory setting
# for the search functionality
- home = ["HTML", "RSS", "JSON"]
+ # add PRINT to home, section and page to activate feature to print whole
+ # chapters
+ home = ["HTML", "RSS", "PRINT", "JSON"]
+ section = ["HTML", "RSS", "PRINT"]
+ page = ["HTML", "RSS", "PRINT"]
[markup]
[markup.highlight]
diff --git a/exampleSite/content/_index.en.md b/exampleSite/content/_index.en.md
index 292fe77299..d2932e1f7c 100644
--- a/exampleSite/content/_index.en.md
+++ b/exampleSite/content/_index.en.md
@@ -18,6 +18,7 @@ See [what's new]({{% relref "basics/migration" %}}) within the latest update.
* Usable offline, no external dependencies
* [Automatic Search]({{%relref "basics/configuration#activate-search" %}})
+* [Print]({{%relref "basics/configuration#activate-print-support" %}}) whole chapters or even the complete site
* [Multilingual mode]({{%relref "cont/i18n" %}}) for English, Arabic, Simplified Chinese, Dutch, French, German, Hindi, Indonesian, Japanese, Korean, Portuguese, Russian, Spanish, Vietnamese, Turkish
* Unlimited menu levels
* Automatic next/prev buttons to navigate through menu entries
diff --git a/exampleSite/content/basics/configuration/_index.en.md b/exampleSite/content/basics/configuration/_index.en.md
index a90bbd1742..f766047712 100644
--- a/exampleSite/content/basics/configuration/_index.en.md
+++ b/exampleSite/content/basics/configuration/_index.en.md
@@ -89,7 +89,7 @@ If not already present, add the follow lines in the same `config.toml` file.
```toml
[outputs]
-home = [ "HTML", "RSS", "JSON"]
+ home = ["HTML", "RSS", "JSON"]
```
Relearn theme uses the last improvement available in hugo version 20+ to generate a json index file ready to be consumed by lunr.js javascript search engine.
@@ -97,6 +97,23 @@ Relearn theme uses the last improvement available in hugo version 20+ to generat
> Hugo generate lunrjs index.json at the root of public folder.
> When you build the site with `hugo server`, hugo generates it internally and of course it doesn’t show up in the filesystem
+## Activate print support
+
+You can activate print support to add the capability to print whole chapters or even the complete site. Just add the `PRINT` output format to your home, section and page in your `config.toml` as seen below:
+
+```toml
+[outputs]
+ home = ["HTML", "RSS", "PRINT", "JSON"]
+ section = ["HTML", "RSS", "PRINT"]
+ page = ["HTML", "RSS", "PRINT"]
+```
+
+This will add a little printer icon in the top bar. It will switch the page to print preview when clicked. You can then send this page to the printer by using your browser's usual print functionality.
+
+{{% notice note %}}
+While colors of your chosen color variant are reset to the theme's light standard values for printing, this does not apply for Mermaid diagrams and Swagger/OpenAPI Specification. Those will still use the colors of your chosen color variant which may cause a non coherent look on paper.
+{{% /notice %}}
+
## Mermaid
The Mermaid configuration parameters can also be set on a specific page. In this case, the global parameter would be overwritten by the local one. See [Mermaid]({{< relref "shortcodes/mermaid.md" >}}) for additional documentation.
diff --git a/exampleSite/content/basics/migration/_index.en.md b/exampleSite/content/basics/migration/_index.en.md
index 5ec65e6ff9..4fc255c113 100644
--- a/exampleSite/content/basics/migration/_index.en.md
+++ b/exampleSite/content/basics/migration/_index.en.md
@@ -18,6 +18,8 @@ This document shows you what's new in the latest release. For a detailed list of
- **Breaking**: If you had previously overwritten the `custom-footer.html` partial to add visual elements below the content of your page, you have to move this content to the new partial `content-footer.html`. `custom-footer.html` was never meant to contain HTML other than additional styles and JavaScript.
+- **New**: You can activate [print support]({{%relref "basics/configuration#activate-print-support" %}}) in your `config.toml` to add the capability to print whole chapters or even the complete site.
+
---
## 3.3.0
diff --git a/exampleSite/content/tests/code/_index.en.md b/exampleSite/content/tests/code/_index.en.md
index 4c4a8cd93d..df9b895a88 100644
--- a/exampleSite/content/tests/code/_index.en.md
+++ b/exampleSite/content/tests/code/_index.en.md
@@ -1,4 +1,5 @@
+++
+description = "Some testing for different styles used in syntax highlightning and preformatted blocks"
title = "Code"
+++
diff --git a/exampleSite/content/tests/code/_index.pir.md b/exampleSite/content/tests/code/_index.pir.md
index a384d10cf8..3207c1936c 100644
--- a/exampleSite/content/tests/code/_index.pir.md
+++ b/exampleSite/content/tests/code/_index.pir.md
@@ -1,4 +1,5 @@
+++
+description = "Some test'n fer different styles used 'n rules highlightn'n an' preformatted blocks"
title = "Code"
+++
{{< piratify >}}
\ No newline at end of file
diff --git a/exampleSite/content/tests/images/_index.en.md b/exampleSite/content/tests/images/_index.en.md
new file mode 100644
index 0000000000..bd2d96fb80
--- /dev/null
+++ b/exampleSite/content/tests/images/_index.en.md
@@ -0,0 +1,58 @@
++++
+description = "Some testing for different styles of image links"
+title = "Images"
++++
+
+Some testing for different styles of image links.
+
+## Markdown
+
+### Relative to page
+
+
+
+### Relative to page up level
+
+
+
+### Static
+
+
+
+### External fully qualified
+
+
+
+### External without scheme
+
+
+
+### External without scheme and scheme separator
+
+
+
+## HTML
+
+### Relative to page
+
+
+
+### Relative to page up level
+
+
+
+### Static
+
+
+
+### External fully qualified
+
+
+
+### External without scheme
+
+
+
+### External without scheme and scheme separator
+
+
diff --git a/exampleSite/content/tests/images/_index.pir.md b/exampleSite/content/tests/images/_index.pir.md
new file mode 100644
index 0000000000..ce50b9d5fe
--- /dev/null
+++ b/exampleSite/content/tests/images/_index.pir.md
@@ -0,0 +1,5 @@
++++
+description = "Some test'n fer different styles o' image links"
+title = "Images"
++++
+{{< piratify >}}
\ No newline at end of file
diff --git a/exampleSite/content/tests/images/images/magic.gif b/exampleSite/content/tests/images/images/magic.gif
new file mode 100644
index 0000000000..235c4edb32
Binary files /dev/null and b/exampleSite/content/tests/images/images/magic.gif differ
diff --git a/exampleSite/content/tests/links/_index.en.md b/exampleSite/content/tests/links/_index.en.md
new file mode 100644
index 0000000000..eefc343598
--- /dev/null
+++ b/exampleSite/content/tests/links/_index.en.md
@@ -0,0 +1,20 @@
++++
+description = "Some testing for different styles of links"
+title = "Links"
++++
+
+Some testing for different styles of links.
+
+## Markdown
+
+### Relative to page:
+
+
+
+### Relative to page up level:
+
+
+
+### Static:
+
+
diff --git a/exampleSite/content/tests/links/_index.pir.md b/exampleSite/content/tests/links/_index.pir.md
new file mode 100644
index 0000000000..1588583b66
--- /dev/null
+++ b/exampleSite/content/tests/links/_index.pir.md
@@ -0,0 +1,5 @@
++++
+description = "Some test'n fer different styles o' links"
+title = "Links"
++++
+{{< piratify >}}
\ No newline at end of file
diff --git a/i18n/ar.toml b/i18n/ar.toml
index 73498145ce..bbe66ea2b8 100644
--- a/i18n/ar.toml
+++ b/i18n/ar.toml
@@ -19,6 +19,9 @@ other = "الذهاب إلى الصفحة الرئيسية"
[Edit-this-page]
other = "حرر"
+[Print-this-chapter]
+other = ""
+
[Shortcuts-Title]
other = "المزيد"
diff --git a/i18n/de.toml b/i18n/de.toml
index 4c5f6550c4..4fc1fd34ad 100644
--- a/i18n/de.toml
+++ b/i18n/de.toml
@@ -19,6 +19,9 @@ other = "Gehe zur Homepage"
[Edit-this-page]
other = "Bearbeiten"
+[Print-this-chapter]
+other = "Ganzes Kapitel drucken"
+
[Shortcuts-Title]
other = "Mehr"
diff --git a/i18n/en.toml b/i18n/en.toml
index 1d3c05d9f0..93b46c3c6f 100644
--- a/i18n/en.toml
+++ b/i18n/en.toml
@@ -19,6 +19,9 @@ other = "Go to homepage"
[Edit-this-page]
other = "Edit"
+[Print-this-chapter]
+other = "Print whole chapter"
+
[Shortcuts-Title]
other = "More"
diff --git a/i18n/es.toml b/i18n/es.toml
index 7cffda0f83..acd715526e 100644
--- a/i18n/es.toml
+++ b/i18n/es.toml
@@ -19,6 +19,9 @@ other = "Ir al inicio"
[Edit-this-page]
other = "Editar"
+[Print-this-chapter]
+other = ""
+
[Shortcuts-Title]
other = "Más"
diff --git a/i18n/fr.toml b/i18n/fr.toml
index 480c6f03ea..ef45dffb74 100644
--- a/i18n/fr.toml
+++ b/i18n/fr.toml
@@ -19,6 +19,9 @@ other = "Vers la page d'accueil"
[Edit-this-page]
other = "Éditer"
+[Print-this-chapter]
+other = ""
+
[Shortcuts-Title]
other = "Aller plus loin"
diff --git a/i18n/hi.toml b/i18n/hi.toml
index fd5a99a587..adb62f0336 100644
--- a/i18n/hi.toml
+++ b/i18n/hi.toml
@@ -19,6 +19,9 @@ other = "मुख्य पृष्ठ पर जाऐ"
[Edit-this-page]
other = "संपादन करना"
+[Print-this-chapter]
+other = ""
+
[Shortcuts-Title]
other = "अधिक सामग्री दिखाएं"
diff --git a/i18n/id.toml b/i18n/id.toml
index 9ccf61c247..d849ebe94e 100644
--- a/i18n/id.toml
+++ b/i18n/id.toml
@@ -19,6 +19,9 @@ other = "Ke halaman depan"
[Edit-this-page]
other = "Mengedit"
+[Print-this-chapter]
+other = ""
+
[Shortcuts-Title]
other = "Lainnya"
diff --git a/i18n/ja.toml b/i18n/ja.toml
index c4b8e16d96..25f9616f0e 100644
--- a/i18n/ja.toml
+++ b/i18n/ja.toml
@@ -19,6 +19,9 @@ other = "ホームページへ行く"
[Edit-this-page]
other = "編集"
+[Print-this-chapter]
+other = ""
+
[Shortcuts-Title]
other = "更に"
diff --git a/i18n/kr.toml b/i18n/kr.toml
index b235ed646c..47e399df3d 100644
--- a/i18n/kr.toml
+++ b/i18n/kr.toml
@@ -19,6 +19,9 @@ other = "메인화면"
[Edit-this-page]
other = "편집"
+[Print-this-chapter]
+other = ""
+
[Shortcuts-Title]
other = "외부 링크"
diff --git a/i18n/nl.toml b/i18n/nl.toml
index 599a13c43c..c919a035f9 100644
--- a/i18n/nl.toml
+++ b/i18n/nl.toml
@@ -19,6 +19,9 @@ other = "Naar startpagina"
[Edit-this-page]
other = "Bewerken"
+[Print-this-chapter]
+other = ""
+
[Shortcuts-Title]
other = "Snelkoppelingen"
diff --git a/i18n/pir.toml b/i18n/pir.toml
index 8e7dc2bae2..57e9dd0c6e 100644
--- a/i18n/pir.toml
+++ b/i18n/pir.toml
@@ -19,6 +19,9 @@ other = "Go t' homeplank"
[Edit-this-page]
other = "Edit"
+[Print-this-chapter]
+other = "Prrrint whole chapterrr"
+
[Shortcuts-Title]
other = "Morrre"
diff --git a/i18n/pt.toml b/i18n/pt.toml
index 9410988a9a..00ff652cd9 100644
--- a/i18n/pt.toml
+++ b/i18n/pt.toml
@@ -19,6 +19,9 @@ other = "Ir para o início"
[Edit-this-page]
other = "Editar"
+[Print-this-chapter]
+other = ""
+
[Shortcuts-Title]
other = "Mais"
diff --git a/i18n/ru.toml b/i18n/ru.toml
index 3d8cf0c861..cf23a35e80 100644
--- a/i18n/ru.toml
+++ b/i18n/ru.toml
@@ -19,6 +19,9 @@ other = "Перейти на главную"
[Edit-this-page]
other = "редактировать"
+[Print-this-chapter]
+other = ""
+
[Shortcuts-Title]
other = "Еще"
diff --git a/i18n/tr.toml b/i18n/tr.toml
index 9b71b2cb1b..9e7fb10878 100644
--- a/i18n/tr.toml
+++ b/i18n/tr.toml
@@ -19,6 +19,9 @@ other = "Anasayfaya dön"
[Edit-this-page]
other = "Düzenlemek"
+[Print-this-chapter]
+other = ""
+
[Shortcuts-Title]
other = "Dahası Var"
diff --git a/i18n/vn.toml b/i18n/vn.toml
index ddd45106a8..7cad5b8e85 100644
--- a/i18n/vn.toml
+++ b/i18n/vn.toml
@@ -19,6 +19,9 @@ other = "Đi đến trang chủ"
[Edit-this-page]
other = "Biên tập"
+[Print-this-chapter]
+other = ""
+
[Shortcuts-Title]
other = "Nội dung khác"
diff --git a/i18n/zh-cn.toml b/i18n/zh-cn.toml
index 9fd215917b..484fc1e515 100644
--- a/i18n/zh-cn.toml
+++ b/i18n/zh-cn.toml
@@ -19,6 +19,9 @@ other = "转到主页"
[Edit-this-page]
other = "编辑"
+[Print-this-chapter]
+other = ""
+
[Shortcuts-Title]
other = "更多"
diff --git a/layouts/404.html b/layouts/404.html
index 4e6e10377f..a09c8362f8 100644
--- a/layouts/404.html
+++ b/layouts/404.html
@@ -1,3 +1,4 @@
+{{- .Scratch.Set "relearnOutputFormat" "HTML" }}
diff --git a/layouts/_default/_markup/render-codeblock-mermaid.html b/layouts/_default/_markup/render-codeblock-mermaid.html
index 91940913f8..ee8fb37464 100644
--- a/layouts/_default/_markup/render-codeblock-mermaid.html
+++ b/layouts/_default/_markup/render-codeblock-mermaid.html
@@ -1,4 +1,4 @@