Compare commits

...

125 Commits
v9 ... master

Author SHA1 Message Date
Micah R Ledbetter 115a94122e
Add scrollbar-gutter: stable (#703) 2025-04-07 15:42:04 +02:00
sfavazza 8aa692f195
fix: correct hint shortcodes rendering in lists (#699)
Co-authored-by: Samuele Favazza <samuele.favazza@duagon.com>
2025-04-07 15:38:25 +02:00
gobai 44fa55ddde
fix: change article title from h2 to h1 in single.html (#694)
Signed-off-by: go-bai <599500688@qq.com>
2025-04-07 15:25:20 +02:00
Paweł Sobótka 95bef1b75f
i18n: Add Polish translations (#690)
This adds Polish (PL/🇵🇱) translations within i18n directory.
2025-04-07 15:17:44 +02:00
Vadim (vadcx) 6c86dcfdc6
Docs: Change tabs shortcode example to permit unsafe=false (#689)
The syntax of `{{% code %}}` only expects Markdown inside. That's why it
triggers unsafe warning, if used as a shortcode template.

Instead the only the top table shortcode should be used as
`{{< tabs >}}` to include the HTML, while the user may use only
`{{% tab "Name" %}}` inside and be happily restricted to Markdown.

https://gohugo.io/methods/page/rendershortcodes/#shortcode-notation
https://github.com/InfosecForActivistsTeam/infosec-activists/pull/45
2025-04-07 15:17:19 +02:00
Alex Shpak 645c868cec Hotfix: tabs: improve unique id serialization 2025-02-03 23:19:43 +01:00
ensag-dev fb701f6f7f
i18n: Create oc.yaml (#682) 2025-01-31 00:20:22 +01:00
Alex Shpak 4ebdff516a Add resources to gitignore 2025-01-31 00:10:01 +01:00
Alex Shpak fbb94a56b2 Remote resources folder, not needed for demo sites anymore 2025-01-31 00:09:43 +01:00
Alex Shpak 60f4c03b8b #672: Add tabs unique ID for nested tabs, uses .Ordinal by default 2025-01-30 22:03:07 +01:00
mvtango f889e52566
Three hugo deprecations (#664)
* as per deprecation note: ERROR deprecated: .Site.IsMultiLingual was deprecated in Hugo v0.124.0 and will be removed in Hugo 0.137.0. Use hugo.IsMultilingual instead.

* as per deprecation note: ERROR deprecated: .Site.IsMultiLingual was deprecated in Hugo v0.124.0 and will be removed in Hugo 0.137.0. Use hugo.IsMultilingual instead.

* deprecated: .Sites.First was deprecated in Hugo v0.127.0 and will be removed in a future release.

* as per deprecation note: ERROR deprecated: .Site.IsMultiLingual was deprecated in Hugo v0.124.0 and will be removed in Hugo 0.137.0. Use hugo.IsMultilingual instead.

* resources.ToCSS was deprecated in Hugo v0.128.0 and will be removed in a future release. Use css.Sass instead.

* ignore ressources from example site
2025-01-29 02:46:56 +01:00
Alex Shpak 7c78a39c53 Align spacings and colors in titles and buttons 2024-10-09 23:27:54 +02:00
Alex Shpak e4c062890b Switch to font-display: fallback to reduce flickering 2024-10-09 17:05:20 +02:00
Alex Shpak 2b7a0e87c3 Deprecate section shortcode 2024-10-08 15:50:46 +02:00
Alex Shpak f8a0e8976b Rewrite tabs shortcode to make them simpler 2024-10-08 15:49:39 +02:00
Alex Shpak 1bda9fb34d Introduce i18n shortcode to add translated strings to markdown pages 2024-10-08 13:57:33 +02:00
Alex Shpak 21e7727a0e Update generated styles 2024-10-04 15:35:43 +02:00
Alex Shpak a5fdf88017 let numbered plugin count nested headings 2024-10-04 15:35:02 +02:00
loikein 15c85acfcd
add number for mobile toc, fix order for nested titles (#555)
Co-authored-by: Alex Shpak <alex-shpak@users.noreply.github.com>
2024-10-04 15:32:07 +02:00
Alex Shpak d008a21049 Fix syntax in Katex markdown file 2024-10-04 13:41:30 +02:00
Alex Shpak 9cc0b0225d #422, add support for column ratios in shortcode 2024-10-04 13:36:14 +02:00
Alex Shpak 925dbd3b9f Breaking change: switch to '{{%' decorators in shortcodes to better support shortcode-in-shortcode 2024-10-04 11:29:44 +02:00
Alex Shpak 69886cc74b Update favicon, move to separate shortcode for customization 2024-10-04 10:59:28 +02:00
Alex Shpak e585c86a81 Update Roboto font and use optional swap 2024-10-03 13:59:55 +02:00
Alex Shpak 3f56e60b6d #414, Move commit and edit links to separate pertials to allow overwrites 2024-10-02 23:16:25 +02:00
Alex Shpak a424a062ca #489: use Rel or Permalink depending on if site is multihost 2024-10-02 16:34:48 +02:00
Alex Shpak 31662538df Remove deprecated bundle/leaf menu type 2024-10-02 16:14:53 +02:00
Alex Shpak 2f64607bc9 Update pos list styles, remove self link from post 2024-10-02 13:25:16 +02:00
Alex Shpak 35bf672b70 Use .InnerDeindent in inline shortcodes 2024-10-02 12:02:41 +02:00
Alex Shpak 2b7b9c3c79 #640: fix line number alignment in code block 2024-10-02 01:45:03 +02:00
anatawa12 657807f879
fix: hreflang for link rel=alternate uses site language code (#654) 2024-10-01 23:37:54 +02:00
Alex Shpak b655b0b7b7 Add horizontal spacing between buttons 2024-10-01 23:34:25 +02:00
Alex Shpak 55c4c45c74 Remove 'expand' shortcode, use 'details' instead 2024-10-01 23:28:57 +02:00
Alex Shpak 3f6dec2482 Bump KaTeX to 0.16.11 2024-10-01 22:50:27 +02:00
Alex Shpak e6d4fbc186 Upgarde mermaidjs to 11.2.1 2024-10-01 22:45:51 +02:00
FuadEfendi 94edf47a12
Fix for spaces being removed during "minify" build for "mermaid" snippet (#613)
"mindmap" style is not rendered correctly with "--minify"  because spaces are removed from final HTML
2024-10-01 22:24:24 +02:00
Rojax 8d56f3fe84
fix: Fixed edit page support for multilang books (#630) 2024-10-01 22:17:03 +02:00
Gram 460d44479b
Auto-generate ID for tabs (#649) 2024-10-01 22:14:16 +02:00
Alex Shpak b25c58878c Bump minimum version in readme to 0.134 2024-10-01 22:07:11 +02:00
Andreas Deininger e54cf3e6d1
Fix deprecation warnings, upgrade to hugo 0.134 (#653) 2024-10-01 21:52:34 +02:00
Michael Schmetter 3588e36948
Update README.md, fixing broken link (#655) 2024-10-01 21:51:36 +02:00
Daniël van de Giessen c19a0a60ff
Add Dutch translations (#631) 2024-09-02 15:03:12 +02:00
Leo Heitmann Ruiz 8e66fc7613
Fix link in README (#618) 2024-09-02 14:58:01 +02:00
Alex Shpak 7c26d9b8b7 Update minimum hugo version in README 2024-05-18 13:14:20 +02:00
Alex Shpak e104a11f42 #582, use time.Format for date formatting 2024-05-18 12:48:43 +02:00
Alex Shpak 90eab4a917 #591, hide search field if JS is not enabled 2024-05-18 12:44:13 +02:00
Alex Shpak ecbe879801 Set minimum hugo version to 0.124 2024-05-18 12:36:23 +02:00
Rajesh Duggal eff55ecd56
Change "config.toml" to "hugo.toml" in the README.md documentation (#596) 2024-05-18 12:32:29 +02:00
Eitan Adler 1c78b920b0
replace .Site.IsMultiLingual with hugo.IsMultilingual (#609)
# Problem

The warning
```
INFO  deprecated: .Site.IsMultiLingual was deprecated in Hugo v0.124.0
and will be removed in a future release. Use hugo.IsMultilingual
instead.``

shows up

# Solution

Follow the deprecation warning
2024-05-18 12:31:58 +02:00
wenbingzhang 1c42a96572
Replace flexsearch with fusejs (#600)
Co-authored-by: 张文兵 <wenbing@mgtv.com>
2024-05-18 12:29:55 +02:00
Essa Alshammri f8a0fc4e24
Add direction ltr to pre > code and highlight (#611)
* Add direction ltr to pre > code and highlight
* Add unicode-bidi: embed;
2024-04-13 11:19:59 +02:00
Leo Heitmann Ruiz 0baec34596
Use null alt text when icon is next to action (#610) 2024-04-13 11:18:14 +02:00
Leo Heitmann Ruiz 2dffe0bc7a
Make image path absolute (#593) 2024-03-11 14:12:18 +01:00
Leo Heitmann Ruiz da22a41f60
Update link to hugo themes (#590) 2024-03-11 14:11:32 +01:00
Alex Shpak a8b156250b #589, change hugo extended url 2024-03-11 13:42:39 +01:00
Alex Shpak a111041867 #583, fix katex and mermaid examples with raw html 2024-02-17 18:57:02 +01:00
Alex Shpak 01645fc56d #521: add canonical url to the header 2024-02-17 18:04:57 +01:00
Alex Shpak cba1eb611a Upgrade mermaidjs to 10.8.0 2024-02-17 17:36:33 +01:00
Andreas Deininger 5e15ddb4f4
Fix typos (#575) 2024-01-10 12:40:24 +01:00
Andreas Deininger 2d7ce27f77
Fix: make use of .Site.Params.BookFavicon (#576) 2024-01-10 12:39:18 +01:00
Alex Shpak 118997fa92 #524: Disable numbered plugin for non-article pages 2023-12-05 00:33:41 +01:00
李宗英 14e14f60ae
fix server worker is blocked (#565)
* fix server worker is blocked

* Also use relURL in manifest

---------

Co-authored-by: Alex Shpak <alex-shpak@users.noreply.github.com>
2023-12-04 22:25:48 +01:00
Alex Shpak 3f1bcccbfb #543, Add summary param for section shortcode 2023-08-08 13:39:20 +02:00
auwsom e7155b473a
Themes dir correction and peaceiris deploy to GitHub Pages (#506)
* commit

* commit

* remove push to /public

---------

Co-authored-by: Alex Shpak <alex-shpak@users.noreply.github.com>
2023-08-08 13:08:03 +02:00
Alex Shpak 16f6203f90 #455, add BookFavicon parameter 2023-08-08 12:40:46 +02:00
nobu1308 1cebd589f6
Update meta theme-color in html-head.html (#527)
theme-color that works in both light and dark mode
2023-08-08 12:10:07 +02:00
Miguel Pimentel 36a7e32815
Update es.yaml (#547)
Added translation for 'Expand'.
Should be 'Expandir' instead.
2023-08-08 12:09:31 +02:00
Alex Shpak d86d5e70c7 Reset generated CSS in example site 2023-04-24 15:41:11 +02:00
Alex Shpak 26fee5551f #528: hotfix for search, until we find a reason 2023-04-24 15:40:42 +02:00
Kanematsu Gaku 12de4671e3
Add "word-break" to list. (#534) 2023-04-24 13:07:08 +02:00
Kanematsu Gaku 9c8210d99b
Format CSS (#535) 2023-04-24 13:06:20 +02:00
Kenta Nakase 036e037a63
Update step for creating site from scratch to use content.en path (#508)
Co-authored-by: parroty <parroty@users.noreply.github.com>
Co-authored-by: Alex Shpak <alex-shpak@users.noreply.github.com>
2023-02-13 23:05:05 +01:00
Alex Shpak 61bb57f32e #496, update content folder name in readme 2023-02-13 22:23:42 +01:00
Gerasimos (Makis) Maropoulos d5b75f4fb3
README.md: fix link path to content.en (#497) 2022-11-11 11:08:54 +01:00
Alex Shpak 3d2bfec186 #445, Upgrade mermaid to 9.2.0 2022-11-03 00:28:15 +01:00
Alex Shpak 412f140762 Bump minimal hugo version to 0.79 2022-11-03 00:11:38 +01:00
Alex Shpak 1318a717ed #441, add menu.params.class support 2022-11-02 23:42:10 +01:00
Alex Shpak 9013a1f457 #352: move english content to content.en 2022-11-02 23:28:30 +01:00
Alex Shpak 6e1b44c4c4 #452: Put double comments on shortcodes 2022-11-02 23:09:40 +01:00
Mikey Lombardi (He/Him) 6090fddebd
(MAINT) Respect LinkTitle in page metadata (#483)
Prior to this commit, the partial for determining a page title used the
`Title` property of a page, if present, or humanized and titleized the
file name if not.

It did not use the `LinkTitle` property at all (defined in the
[front matter][01]). According to the [menu documentation][02]:

> The following order is used to determine an Identifier:
>
> `.Name > .LinkTitle > .Title`
>
> This means that `.Title` will be used unless `.LinkTitle is present,
> etc.

Similar, the documentation for [menu entry variables][03] states:

> The `name` key, if set for the menu entry, sets this value. If that
> key is not set, and if the menu entry is set in a page front-matter,
> this value defaults to the page's `.LinkTitle`.

Together, these imply that if `.LinkTitle` is specified, it should be
preferred over `.Title` for the generated nav menu.

[01]: https://gohugo.io/content-management/front-matter/
[02]: https://gohugo.io/content-management/menus/#nesting
[03]: https://gohugo.io/variables/menus/#menu-entry-variables
2022-10-05 10:01:03 +02:00
Dongliang Yin 317ccae23b
Remove left pagination spacing (#467) 2022-08-02 12:57:40 +02:00
Alexander Danilov c024538604
Ignore code block clicks with active selection (#448) 2022-07-04 08:55:54 +02:00
Alex Shpak 4ef38f3bbf Add .hugo_build.lock to .gitignore 2022-04-26 13:43:10 +02:00
Alex Shpak 1852b16d93 #440L Adjust bookHref, check .Content again, add redirect 2022-04-26 13:14:22 +02:00
Horea Christian c2014a08a5
Add BookHref, set explicit URL for the menu (#440) 2022-04-26 13:10:39 +02:00
Leone G faede5e749
Add Amharic language translations (#444) 2022-04-26 11:35:50 +02:00
Giuseppe Masino 98d19b8e95
Make menu entries' link relative (#421)
This change allows hugo to build pages correcly when
`canonifyURLs = false` and `relativeURLs = true`.
Otherwise the links on the menu will be canonicalized regardless of
configuration.
This results in broken sites in a number of situations, such as sites
served behind a reverse-proxy that don't want to account for the prefix
they're served under.
2022-02-18 17:35:02 +01:00
Andreas Deininger 5581ec0845
REDAME: Katex to KaTeX (#416) 2022-02-14 15:44:11 +01:00
Alex Shpak 3a65df3a76 #408, #410: Use LanguageCode in templates if specified 2022-01-13 19:20:02 +01:00
shawn.ye fb0863a27a
Prevent breaked-lines in <p> (#404) 2022-01-13 16:52:03 +01:00
Samuel Redai 2f60f0919f
Updating book to hugo-book in README (#394)
Looks like the path `/book/` in the readme should be `/hugo-book/`.
2021-12-01 10:43:39 +01:00
Alex Shpak 2e693816ae #385: Do not focus search field if current element has value 2021-11-19 14:24:28 +01:00
QIN2DIM c47eb7388a
Rename theme in readmin to hugo-book (#386)
* Update README.md
* Update README.md

Co-authored-by: Alex Shpak <alex-shpak@users.noreply.github.com>
2021-11-19 13:33:01 +01:00
Alex Shpak 8bb6d7ebec #369, switch to google_analytics.html internal template 2021-10-19 22:05:41 +02:00
Nikolay Raspopov 6c3d1e942a
Removed extra Google Analitics include (#389)
It's already included via "docs/html-head" partial.
2021-10-19 21:56:36 +02:00
Jack Morgan 9d4916fcc2
Allow site title to be customised via parital (#384)
* Allow site title to be customised via parital
* Modify readme to highlight available partials
* Rename template for consistency
* Move title tags to head partial
2021-09-27 09:36:02 +02:00
xhdix f2fb37b1ad
add color-scheme to head-html (#387) 2021-09-26 21:47:58 +02:00
Alex Shpak d6087bd32d Add hugo init to install instructions 2021-09-11 21:27:19 +02:00
Alex Shpak 15ef744c94 Rollback flexsearch for now 2021-09-08 23:41:49 +02:00
Michael T Lombardi (He/Him) 6aef8ef1c7
(GH-375) Enable use as a hugo module (#376)
This commit does the minimal work to make the Book theme a functional
hugo module by adding the go.mod file and including instructions in
the project README for use.

Resolves #375
2021-09-07 22:05:33 +02:00
Alex Shpak a656d711bf Upgrade flexsearch and mermaid 2021-08-30 14:47:27 +02:00
Alex Shpak 0cde2e461d #370: Allow markdown in details shortcode, also change markdownify to RenderString in other shortcodes 2021-08-30 14:32:11 +02:00
Alex Shpak 4c1de2b3de #374: set auto height for images in markdown 2021-08-30 14:15:57 +02:00
Alex Shpak 26de844a19 #343, #165: Move lang selector to left menu 2021-08-18 11:12:58 +02:00
Alex Shpak 50147be131
Update README.md 2021-07-25 22:44:14 +02:00
Alex Shpak deb00bcad2
Update theme.toml 2021-07-25 22:41:58 +02:00
逊狼 92d97049cf
issues 362 (#364)
* 🐞 fix issues 352

Solve this problem:
https://github.com/alex-shpak/hugo-book/issues/352

The Reason:
https://github.com/gohugoio/hugo/issues/8688

* fix issues 362

https://github.com/alex-shpak/hugo-book/issues/362

* Revert "🐞 fix issues 352"

This reverts commit 58f8935d1e.

* Revert "Revert "🐞 fix issues 352""

This reverts commit fa0d46ccf5.

* fix issues 362

* Update columns.html

* Revert "Revert "Revert "🐞 fix issues 352"""

This reverts commit 79777a9e84.

Co-authored-by: Alex Shpak <alex-shpak@users.noreply.github.com>
2021-07-20 16:20:43 +02:00
Marco Guerrini c4d69635af
Added italian translation (#356) 2021-07-01 11:26:02 +02:00
xhdix e939f40314
Add Farsi with support for search RTL texts (#350)
Farsi/Parsi/Persian
2021-06-21 21:11:36 +02:00
xhdix 0d2ed5586e
Change collapsed icon in menu for RTL pages (#354) 2021-06-21 20:18:14 +02:00
xhdix 379e311d7e
Fix menu not working in RTL menu (#349) 2021-06-08 10:08:46 +02:00
Nikolay Raspopov 4540d66e3b
Document removal of internal hugo templates (#345) 2021-05-27 09:11:13 +02:00
Alex Shpak fde10f1319 #285, skip integrity attribute if site is built without hostname 2021-05-21 00:50:38 +02:00
Alex Shpak f6e8d1b693 Add deprecation notice for menu bundle 2021-05-21 00:46:53 +02:00
Nikolay Raspopov 345cb5d947
Prefer existing and translated variant of home page (#342)
* Prefer existing and translated variant of home page as the site link in the menu header.
* More compact "cond"-version of fix.
2021-05-20 22:02:31 +02:00
Alex Shpak 553d378db3 Fix lighthouse remarks: icon sizes, noopener 2021-05-20 19:00:15 +02:00
Alex Shpak 195138cad0 Update roboto fonts 2021-05-20 11:28:51 +02:00
Alex Shpak 9b2e21f870 Refactor search, syntax error 2021-05-19 20:28:21 +02:00
Alex Shpak d7c644f0e7 Refactor search, prepare for pre-built indexing 2021-05-19 20:26:21 +02:00
Alex Shpak 843144dd85 Regression, fix menu reset script 2021-05-19 20:12:27 +02:00
Nikolay Raspopov 4d936a55d8
Fixed ineffective "disableHugoGeneratorInject" parameter (#337)
Fixed issue #336. HUGO does not use `{{ hugo.Generator }}` placeholder anymore.
2021-05-06 09:33:18 +02:00
Alex Shpak 6720168dd5 #281, Copy code block content on click 2021-05-03 23:52:00 +02:00
Alex Shpak 6a1932611c Update MermaidJS example 2021-05-03 23:14:20 +02:00
Alex Shpak e611f564bb Update archetypes 2021-05-03 23:06:43 +02:00
Alex Shpak f4a26ff3da Imporove sectiopn shortcode example 2021-05-03 22:59:33 +02:00
186 changed files with 2975 additions and 870 deletions

View File

@ -9,12 +9,15 @@ jobs:
matrix:
hugo-version:
- 'latest'
- '0.68.0'
- '0.134.2'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: true # Fetch Hugo themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
uses: peaceiris/actions-hugo@v3
with:
hugo-version: ${{ matrix.hugo-version }}
extended: true
@ -22,3 +25,10 @@ jobs:
- name: Run Hugo
working-directory: exampleSite
run: hugo --themesDir ../..
# - name: Deploy
# uses: peaceiris/actions-gh-pages@v3
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# publish_dir: ./public

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
public/
exampleSite/public/
.DS_Store
.hugo_build.lock
resources/

130
README.md
View File

@ -1,12 +1,12 @@
# Hugo Book Theme
[![Hugo](https://img.shields.io/badge/hugo-0.68-blue.svg)](https://gohugo.io)
[![Hugo](https://img.shields.io/badge/hugo-0.134-blue.svg)](https://gohugo.io)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
![Build with Hugo](https://github.com/alex-shpak/hugo-book/workflows/Build%20with%20Hugo/badge.svg)
### [Hugo](https://gohugo.io) documentation theme as simple as plain book
![Screenshot](https://github.com/alex-shpak/hugo-book/blob/master/images/screenshot.png)
![Screenshot](https://raw.githubusercontent.com/alex-shpak/hugo-book/master/images/screenshot.png)
- [Features](#features)
- [Requirements](#requirements)
@ -33,21 +33,46 @@
## Requirements
- Hugo 0.68 or higher
- Hugo extended version, read more [here](https://gohugo.io/news/0.48-relnotes/)
- Hugo 0.134 or higher
- Hugo extended version, [Installation Instructions](https://gohugo.io/installation/)
## Installation
### Install as git submodule
Navigate to your hugo project root and run:
```
git submodule add https://github.com/alex-shpak/hugo-book themes/book
git submodule add https://github.com/alex-shpak/hugo-book themes/hugo-book
```
Then run hugo (or set `theme = "book"`/`theme: book` in configuration file)
Then run hugo (or set `theme = "hugo-book"`/`theme: hugo-book` in configuration file)
```
hugo server --minify --theme book
hugo server --minify --theme hugo-book
```
### Install as hugo module
You can also add this theme as a Hugo module instead of a git submodule.
Start with initializing hugo modules, if not done yet:
```
hugo mod init github.com/repo/path
```
Navigate to your hugo project root and add [module] section to your `hugo.toml`:
```toml
[module]
[[module.imports]]
path = 'github.com/alex-shpak/hugo-book'
```
Then, to load/update the theme module and run hugo:
```sh
hugo mod get -u
hugo server --minify
```
### Creating site from scratch
@ -57,54 +82,18 @@ Below is an example on how to create a new site from scratch:
```sh
hugo new site mydocs; cd mydocs
git init
git submodule add https://github.com/alex-shpak/hugo-book themes/book
cp -R themes/book/exampleSite/content .
git submodule add https://github.com/alex-shpak/hugo-book themes/hugo-book
cp -R themes/hugo-book/exampleSite/content.en/* ./content
```
```sh
hugo server --minify --theme book
hugo server --minify --theme hugo-book
```
## Menu
### File tree menu (default)
By default, the theme will render pages from the `content/docs` section as a menu in a tree structure.
You can set `title` and `weight` in the front matter of pages to adjust the order and titles in the menu.
### Leaf bundle menu
You can also use leaf bundle and the content of its `index.md` file as menu.
Given you have the following file structure:
```
├── content
│ ├── docs
│ │ ├── page-one.md
│ │ └── page-two.md
│ └── posts
│ ├── post-one.md
│ └── post-two.md
```
Create a file `content/menu/index.md` with the content:
```md
+++
headless = true
+++
- [Book Example]({{< relref "/docs/" >}})
- [Page One]({{< relref "/docs/page-one" >}})
- [Page Two]({{< relref "/docs/page-two" >}})
- [Blog]({{< relref "/posts" >}})
```
And Enable it by setting `BookMenuBundle: /menu` in Site configuration.
- [Example menu](https://github.com/alex-shpak/hugo-book/blob/master/exampleSite/content/menu/index.md)
- [Example config file](https://github.com/alex-shpak/hugo-book/blob/master/exampleSite/config.yaml)
- [Leaf bundles](https://gohugo.io/content-management/page-bundles/)
You can set `title` and `weight` in the front matter of pages to adjust the order and titles in the menu, as well as other parameters to hide or alter urls in the menu. You can choose which folder to use for generating menu with `BookSection` configuration parameter.
## Blog
@ -115,8 +104,8 @@ A blog is not the primary usecase of this theme, so it has only minimal features
### Site Configuration
There are a few configuration options that you can add to your `config.toml` file.
You can also see the `yaml` example [here](https://github.com/alex-shpak/hugo-book/blob/master/exampleSite/config.yaml).
There are a few configuration options that you can add to your `hugo.toml` file.
You can also see the `yaml` example [here](https://github.com/alex-shpak/hugo-book/blob/master/exampleSite/hugo.yaml).
```toml
# (Optional) Set Google Analytics if you use it to track your website.
@ -152,10 +141,6 @@ disableKinds = ['taxonomy', 'taxonomyTerm']
# /static/logo.png then the path would be 'logo.png'
BookLogo = 'logo.png'
# (Optional, default none) Set leaf bundle to render as side menu
# When not specified file structure and weights will be used
BookMenuBundle = '/menu'
# (Optional, default docs) Specify section of content to render as menu
# You can also set value to "*" to render all sections to menu
BookSection = 'docs'
@ -163,7 +148,7 @@ disableKinds = ['taxonomy', 'taxonomyTerm']
# Set source repository location.
# Used for 'Last Modified' and 'Edit this page' links.
BookRepo = 'https://github.com/alex-shpak/hugo-book'
# Specifies commit portion of the link to the page's last modified commit hash for 'doc' page
# type.
# Required if 'BookRepo' param is set.
@ -215,16 +200,16 @@ You can specify additional params in the front matter of individual pages:
# Set type to 'docs' if you want to render page outside of configured section or if you render section other than 'docs'
type = 'docs'
# Set page weight to re-arrange items in file-tree menu (if BookMenuBundle not set)
# Set page weight to re-arrange items in file-tree menu.
weight = 10
# (Optional) Set to 'true' to mark page as flat section in file-tree menu (if BookMenuBundle not set)
# (Optional) Set to 'true' to mark page as flat section in file-tree menu.
bookFlatSection = false
# (Optional) Set to hide nested sections or pages at that level. Works only with file-tree menu mode
bookCollapseSection = true
# (Optional) Set true to hide page or section from side menu (if BookMenuBundle not set)
# (Optional) Set true to hide page or section from side menu.
bookHidden = false
# (Optional) Set 'false' to hide ToC from page
@ -235,13 +220,18 @@ bookComments = true
# (Optional) Set to 'false' to exclude page from search index.
bookSearchExclude = true
# (Optional) Set explicit href attribute for this page in a menu.
bookHref = ''
```
### Partials
There are few empty partials you can override in `layouts/partials/`
There are layout partials available for you to easily override components of the theme in `layouts/partials/`.
| Partial | Placement |
In addition to this, there are several empty partials you can override to easily add/inject code.
| Empty Partial | Placement |
| -------------------------------------------------- | ------------------------------------------- |
| `layouts/partials/docs/inject/head.html` | Before closing `<head>` tag |
| `layouts/partials/docs/inject/body.html` | Before closing `<body>` tag |
@ -265,7 +255,7 @@ There are few empty partials you can override in `layouts/partials/`
### Plugins
There are a few features implemented as plugable `scss` styles. Usually these are features that don't make it to the core but can still be useful.
There are a few features implemented as pluggable `scss` styles. Usually these are features that don't make it to the core but can still be useful.
| Plugin | Description |
| --------------------------------- | ----------------------------------------------------------- |
@ -281,15 +271,21 @@ There are a few hugo templates inserted in `<head>`
- [Google Analytics](https://gohugo.io/templates/internal/#google-analytics)
- [Open Graph](https://gohugo.io/templates/internal/#open-graph)
To disable Open Graph inclusion you can create your own empty file `\layouts\_internal\opengraph.html`.
In fact almost empty not quite empty because an empty file looks like absent for HUGO. For example:
```
<!-- -->
```
## Shortcodes
- [Buttons](https://themes.gohugo.io/theme/hugo-book/docs/shortcodes/buttons/)
- [Columns](https://themes.gohugo.io/theme/hugo-book/docs/shortcodes/columns/)
- [Expand](https://themes.gohugo.io/theme/hugo-book/docs/shortcodes/expand/)
- [Hints](https://themes.gohugo.io/theme/hugo-book/docs/shortcodes/hints/)
- [KaTeX](https://themes.gohugo.io/theme/hugo-book/docs/shortcodes/katex/)
- [Mermaid](https://themes.gohugo.io/theme/hugo-book/docs/shortcodes/mermaid/)
- [Tabs](https://themes.gohugo.io/theme/hugo-book/docs/shortcodes/tabs/)
- [Buttons](https://hugo-book-demo.netlify.app/docs/shortcodes/buttons/)
- [Columns](https://hugo-book-demo.netlify.app/docs/shortcodes/columns/)
- [Details](https://hugo-book-demo.netlify.app/docs/shortcodes/details/)
- [Hints](https://hugo-book-demo.netlify.app/docs/shortcodes/hints/)
- [KaTeX](https://hugo-book-demo.netlify.app/docs/shortcodes/katex/)
- [Mermaid](https://hugo-book-demo.netlify.app/docs/shortcodes/mermaid/)
- [Tabs](https://hugo-book-demo.netlify.app/docs/shortcodes/tabs/)
By default, Goldmark trims unsafe outputs which might prevent some shortcodes from rendering. It is recommended to set `markup.goldmark.renderer.unsafe=true` if you encounter problems.

View File

@ -5,5 +5,6 @@ weight: 1
# bookToc: true
# bookHidden: false
# bookCollapseSection: false
# bookComments: true
# bookComments: false
# bookSearchExclude: false
---

View File

@ -1,4 +1,6 @@
---
title: "{{ replace .Name "-" " " | title }}"
title: "{{ .Name | humanize | title }}"
date: {{ .Date }}
# bookComments: false
# bookSearchExclude: false
---

View File

@ -16,7 +16,6 @@ $body-font-weight: normal !default;
$body-min-width: 20rem !default;
$container-max-width: 80rem !default;
$header-height: 3.5rem !default;
$menu-width: 16rem !default;
$toc-width: 16rem !default;
@ -48,9 +47,9 @@ $hint-colors: (
}
@mixin theme-dark {
--gray-100: rgba(255, 255, 255, 0.1);
--gray-200: rgba(255, 255, 255, 0.2);
--gray-500: rgba(255, 255, 255, 0.5);
--gray-100: #494e54;
--gray-200: #5c6165;
--gray-500: #999d9f;
--color-link: #84b2ff;
--color-visited-link: #b88dff;

View File

@ -1,43 +1,28 @@
/* roboto-300italic - latin */
@font-face {
font-family: 'Roboto';
font-style: italic;
font-weight: 300;
font-display: swap;
src: local('Roboto Light Italic'), local('Roboto-LightItalic'),
url('fonts/roboto-v19-latin-300italic.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
url('fonts/roboto-v19-latin-300italic.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
}
/* roboto-regular - latin */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
font-display: swap;
src: local('Roboto'), local('Roboto-Regular'),
url('fonts/roboto-v19-latin-regular.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
url('fonts/roboto-v19-latin-regular.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
font-display: fallback;
src: url(https://fonts.gstatic.com/s/roboto/v32/KFOmCnqEu92Fr1Mu4mxKKTU1Kg.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* roboto-700 - latin */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 700;
font-display: swap;
src: local('Roboto Bold'), local('Roboto-Bold'),
url('fonts/roboto-v19-latin-700.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
url('fonts/roboto-v19-latin-700.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
font-display: fallback;
src: url(https://fonts.gstatic.com/s/roboto/v32/KFOlCnqEu92Fr1MmWUlfBBc4AMP6lQ.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* roboto-mono-regular - latin */
@font-face {
font-family: 'Roboto Mono';
font-style: normal;
font-weight: 400;
font-display: swap;
src: local('Roboto Mono'), local('RobotoMono-Regular'),
url('fonts/roboto-mono-v6-latin-regular.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
url('fonts/roboto-mono-v6-latin-regular.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
font-display: fallback;
src: url(https://fonts.gstatic.com/s/robotomono/v23/L0xuDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vq_ROW4AJi8SJQt.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
body {

View File

@ -2,6 +2,7 @@ html {
font-size: $font-size-base;
scroll-behavior: smooth;
touch-action: manipulation;
scrollbar-gutter: stable;
}
body {
@ -9,7 +10,7 @@ body {
color: var(--body-font-color);
background: var(--body-background);
letter-spacing: 0.33px;
// letter-spacing: 0.33px;
font-weight: $body-font-weight;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
@ -69,6 +70,7 @@ ul.pagination {
display: flex;
justify-content: center;
list-style-type: none;
padding-inline-start: 0px;
.page-item a {
padding: $padding-16;
@ -84,13 +86,19 @@ ul.pagination {
filter: var(--icon-filter);
}
a .book-icon {
height: 1em;
width: 1em;
margin-inline-end: .5em;
}
.book-brand {
margin-top: 0;
margin-bottom: $padding-16;
img {
height: 1.5em;
width: auto;
vertical-align: middle;
width: 1.5em;
margin-inline-end: $padding-8;
}
}
@ -135,13 +143,20 @@ ul.pagination {
}
}
.book-section-flat {
margin-bottom: $padding-16 * 2;
&:not(:first-child) {
margin-top: $padding-16 * 2;
// for RTL support
body[dir="rtl"] .book-menu {
input.toggle + label::after {
content: "";
}
input.toggle:checked + label::after {
content: "";
}
}
.book-section-flat {
margin: $padding-16 * 2 0;
> a,
> span,
> label {
@ -160,7 +175,17 @@ ul.pagination {
}
.book-post {
margin-bottom: $padding-16 * 3;
margin-bottom: $padding-16 * 2;
.book-post-date img {
height: 1em;
width: 1em;
margin-inline-end: .5em;
}
.book-post-content > :first-child {
margin-top: $padding-16;
}
}
.book-header {
@ -170,6 +195,17 @@ ul.pagination {
label {
line-height: 0;
}
h3 {
overflow: hidden;
text-overflow: ellipsis;
margin: 0 $padding-16;
}
img.book-icon {
height: 1.5em;
width: 1.5em;
}
}
.book-search {
@ -226,6 +262,7 @@ ul.pagination {
img {
height: 1em;
width: 1em;
}
nav > ul > li:first-child {
@ -236,11 +273,6 @@ ul.pagination {
.book-footer {
padding-top: $padding-16;
font-size: $font-size-14;
img {
height: 1em;
margin-inline-end: $padding-8;
}
}
.book-comments {
@ -248,60 +280,11 @@ ul.pagination {
}
.book-languages {
position: relative;
overflow: visible;
padding: $padding-16;
margin: -$padding-16;
margin-block-end: $padding-16 * 2;
ul {
margin: 0;
padding: 0;
list-style: none;
li {
white-space: nowrap;
cursor: pointer;
}
padding-inline-start: 1.5em;
}
&:hover,
&:focus,
&:focus-within {
.book-languages-list {
display: block;
}
}
.book-languages-list {
display: none;
position: absolute;
bottom: 100%;
left: 0;
padding: $padding-8 0;
background: var(--body-background);
box-shadow: 0 0 $padding-4 rgba(0, 0, 0, 0.1);
li img {
opacity: 0.25;
}
li.active img,
li:hover img {
opacity: initial;
}
a {
color: inherit;
padding: $padding-8 $padding-16;
}
}
}
.book-home {
padding: $padding-16;
}
// Responsive styles
@ -324,7 +307,6 @@ ul.pagination {
.book-menu {
visibility: hidden;
margin-inline-start: -$menu-width;
font-size: $font-size-base;
z-index: 1;
}
@ -374,8 +356,8 @@ ul.pagination {
}
}
//for RTL support
body[dir="rtl"] #menu-control:checked + main {
// for RTL support
body[dir="rtl"] #menu-control:checked ~ main {
.book-menu .book-menu-content {
transform: translateX(-$menu-width);
}

View File

@ -65,9 +65,12 @@
img {
max-width: 100%;
height: auto;
}
code {
direction: ltr;
unicode-bidi: embed;
padding: 0 $padding-4;
background: var(--gray-200);
border-radius: $border-radius;
@ -75,6 +78,8 @@
}
pre {
direction: ltr;
unicode-bidi: embed;
padding: $padding-16;
background: var(--gray-100);
border-radius: $border-radius;
@ -86,6 +91,10 @@
}
}
p {
word-wrap: break-word;
}
blockquote {
margin: $padding-16 0;
padding: $padding-8 $padding-16 $padding-8 ($padding-16 - $padding-4); //to keep total left space 16dp
@ -129,6 +138,7 @@
ul,
ol {
padding-inline-start: $padding-16 * 2;
word-wrap: break-word;
}
dl {
@ -138,20 +148,31 @@
}
dd {
margin-inline-start: $padding-16;
margin-inline-start: 0;
margin-bottom: $padding-16;
}
}
// Special case for highlighted code with line numbers
.highlight table tr {
td:nth-child(1) pre {
margin: 0;
padding-inline-end: 0;
}
td:nth-child(2) pre {
margin: 0;
padding-inline-start: 0;
.highlight {
direction: ltr;
unicode-bidi: embed;
border-radius: $border-radius;
overflow: hidden;
table tr {
td pre code > span {
display: flex;
}
td:nth-child(1) pre {
margin: 0;
padding-inline-end: 0;
}
td:nth-child(2) pre {
margin: 0;
padding-inline-start: 0;
}
}
}

View File

@ -71,7 +71,7 @@
> div {
margin: $padding-16 0;
min-width: $body-min-width / 2;
min-width: $body-min-width * 0.66;
padding: 0 $padding-16;
}
}

View File

@ -50,6 +50,10 @@
text-align: right;
}
.text-small {
font-size: .875em;
}
.hidden {
display: none;
}

24
assets/clipboard.js Normal file
View File

@ -0,0 +1,24 @@
(function () {
function select(element) {
const selection = window.getSelection();
const range = document.createRange();
range.selectNodeContents(element);
selection.removeAllRanges();
selection.addRange(range);
}
document.querySelectorAll("pre code").forEach(code => {
code.addEventListener("click", function (event) {
if (window.getSelection().toString()) {
return;
}
select(code.parentElement);
if (navigator.clipboard) {
navigator.clipboard.writeText(code.parentElement.textContent);
}
});
});
})();

View File

@ -1,14 +1,14 @@
{
"name": "{{ .Site.Title }}",
"short_name": "{{ .Site.Title }}",
"start_url": "{{ "/" | relURL }}",
"scope": "{{ "/" | relURL }}",
"start_url": "{{ "./" | relURL }}",
"scope": "{{ "./" | relURL }}",
"display": "standalone",
"background_color": "#000000",
"theme_color": "#000000",
"icons": [
{
"src": "{{ "/favicon.svg" | relURL }}",
"src": "{{ "./favicon.svg" | relURL }}",
"sizes": "512x512"
}
]

View File

@ -1,5 +1,5 @@
(function() {
var menu = document.querySelector("aside.book-menu nav");
var menu = document.querySelector("aside .book-menu-content");
addEventListener("beforeunload", function(event) {
localStorage.setItem("menu.scrollTop", menu.scrollTop);
});

View File

@ -1,9 +1,9 @@
$startLevel: 1;
$endLevel: 6;
.book-page .markdown {
.book-page .markdown.book-article {
@for $currentLevel from $startLevel through $endLevel {
> h#{$currentLevel} {
h#{$currentLevel} {
counter-increment: h#{$currentLevel};
counter-reset: h#{$currentLevel + 1};
@ -19,14 +19,12 @@ $endLevel: 6;
}
}
.book-toc nav ul {
.book-toc nav#TableOfContents ul {
counter-reset: item;
li {
counter-increment: item;
&:first-child {
counter-reset: item;
}
&:before {
content: counters(item, ".") ". ";
float: left;

View File

@ -1,32 +0,0 @@
'use strict';
(function () {
const indexCfg = {{ with i18n "bookSearchConfig" }}
{{ . }};
{{ else }}
{};
{{ end }}
indexCfg.doc = {
id: 'id',
field: ['title', 'content'],
store: ['title', 'href', 'section'],
};
const index = FlexSearch.create('balance', indexCfg);
window.bookSearchIndex = index;
{{- $pages := where .Site.Pages "Kind" "in" (slice "page" "section") -}}
{{- $pages = where $pages "Params.booksearchexclude" "!=" true -}}
{{- $pages = where $pages "Content" "not in" (slice nil "") -}}
{{ range $index, $page := $pages }}
index.add({
'id': {{ $index }},
'href': '{{ $page.RelPermalink }}',
'title': {{ (partial "docs/title" $page) | jsonify }},
'section': {{ (partial "docs/title" $page.Parent) | jsonify }},
'content': {{ $page.Plain | jsonify }}
});
{{- end -}}
})();

17
assets/search-data.json Normal file
View File

@ -0,0 +1,17 @@
[
{{- $pages := where .Site.Pages "Kind" "in" (slice "page" "section") -}}
{{- $pages = where $pages "Params.bookSearchExclude" "!=" true -}}
{{/* Remove until we know why it does not work, see https://github.com/alex-shpak/hugo-book/issues/528 */}}
{{/*- $pages = where $pages "Content" "not in" (slice nil "") -*/}}
{{- $pages = where $pages "Content" "!=" "" -}}
{{ range $index, $page := $pages }}
{{ if gt $index 0}},{{end}} {
"id": {{ $index }},
"href": "{{ $page.RelPermalink }}",
"title": {{ (partial "docs/title" $page) | jsonify }},
"section": {{ (partial "docs/title" $page.Parent) | jsonify }},
"content": {{ $page.Plain | jsonify }}
}
{{- end -}}
]

View File

@ -1,9 +1,29 @@
'use strict';
{{ $searchDataFile := printf "%s.search-data.js" .Language.Lang }}
{{ $searchData := resources.Get "search-data.js" | resources.ExecuteAsTemplate $searchDataFile . | resources.Minify | resources.Fingerprint }}
{{ $searchDataFile := printf "%s.search-data.json" .Language.Lang }}
{{ $searchData := resources.Get "search-data.json" | resources.ExecuteAsTemplate $searchDataFile . | resources.Minify | resources.Fingerprint }}
{{ $searchConfig := i18n "bookSearchConfig" | default "{}" }}
(function () {
const searchDataURL = '{{ $searchData.RelPermalink }}';
const indexConfig = Object.assign({{ $searchConfig }}, {
includeScore: true,
useExtendedSearch: true,
fieldNormWeight: 1.5,
threshold: 0.2,
ignoreLocation: true,
keys: [
{
name: 'title',
weight: 0.7
},
{
name: 'content',
weight: 0.3
}
]
});
const input = document.querySelector('#book-search-input');
const results = document.querySelector('#book-search-results');
@ -20,6 +40,10 @@
* @param {Event} event
*/
function focusSearchFieldOnKeyPress(event) {
if (event.target.value !== undefined) {
return;
}
if (input === document.activeElement) {
return;
}
@ -46,11 +70,13 @@
input.removeEventListener('focus', init); // init once
input.required = true;
loadScript('{{ "flexsearch.min.js" | relURL }}');
loadScript('{{ $searchData.RelPermalink }}', function () {
input.required = false;
search();
});
fetch(searchDataURL)
.then(pages => pages.json())
.then(pages => {
window.bookSearchIndex = new Fuse(pages, indexConfig);
})
.then(() => input.required = false)
.then(search);
}
function search() {
@ -62,33 +88,19 @@
return;
}
const searchHits = window.bookSearchIndex.search(input.value, 10);
const searchHits = window.bookSearchIndex.search(input.value).slice(0,10);
searchHits.forEach(function (page) {
const li = element('<li><a href></a><small></small></li>');
const a = li.querySelector('a'), small = li.querySelector('small');
a.href = page.href;
a.textContent = page.title;
small.textContent = page.section;
a.href = page.item.href;
a.textContent = page.item.title;
small.textContent = page.item.section;
results.appendChild(li);
});
}
/**
* @param {String} src
* @param {Function} callback
*/
function loadScript(src, callback) {
const script = document.createElement('script');
script.defer = true;
script.async = false;
script.src = src;
script.onload = callback;
document.head.appendChild(script);
}
/**
* @param {String} content
* @returns {Node}

View File

@ -2,6 +2,6 @@
if (navigator.serviceWorker) {
navigator.serviceWorker.register(
"{{ $swJS.RelPermalink }}",
{ scope: "{{ "/" | relURL }}" }
{ scope: "{{ "./" | relURL }}" }
);
}

View File

@ -1,79 +0,0 @@
---
title: ভূমিকা
type: docs
---
# বাংলা ভাষায় শুরু করুন
{{< columns >}}
## অস্ট্রিস চিপসে ফুর্তিভা
Est in vagis et Pittheus tu arge accipiter regia iram vocatur nurus. Omnes ut
olivae sensit **arma sorori** deducit, inesset **crudus**, ego vetuere aliis,
modo arsit? Utinam rapta fiducia valuere litora _adicit cursu_, ad facies
<--->
## সুইস কোটা ভোটে
Ea _furtique_ risere fratres edidit terrae magis. Colla tam mihi tenebat:
miseram excita suadent es pecudes iam. Concilio _quam_ velatus posset ait quod
nunc! Fragosis suae dextra geruntur functus vulgata.
{{< /columns >}}
## টেম্পোরার নিশি
Lorem **markdownum** emicat gestu. Cannis sol pressit ducta. **Est** Idaei,
tremens ausim se tutaeque, illi ulnis hausit, sed, lumina cutem. Quae avis
sequens!
var panel = ram_design;
if (backup + system) {
file.readPoint = network_native;
sidebar_engine_device(cell_tftp_raster,
dual_login_paper.adf_vci.application_reader_design(
graphicsNvramCdma, lpi_footer_snmp, integer_model));
}
public_keyboard_docking += error.controller_gibibyte_plug.ip(4,
asciiPetaflops, software(supercomputer_compatible_status + 4));
dynamic_disk.indexModeLaptop = bufferTftpReality;
var export_vlog_sequence = trinitron_flowchart + supercomputer_cluster_rj(
-1, toolbar_powerpoint_query, -2 / multiprocessing_impression);
## Locis suis novi cum suoque decidit eadem
Idmoniae ripis, at aves, ali missa adest, ut _et autem_, et ab? Venit spes
versus finis sermonibus patefecit murum nec est sine oculis. _Ille_ inmota
macies domoque caelestia cadit tantummodo scelus procul, corde!
1. Dolentem capi parte rostro alvum habentem pudor
2. Fulgentia sanguine paret
3. E punior consurgit lentus
4. Vox hasta eras micantes
## Facibus pharetrae indetonsusque indulsit sic incurrite foliis
Nefandam et prisci palmas! Blandita cutis flectitur montis macies, te _nati_
Latiis; turbaque inferias. Virginis tibi peracta avidusque facies caper nec, e
at ademptae, mira.
direct *= font(inputScareware(sliHome), crossplatform.byte(
ppl_encryption.excel_e_rte(integratedModelModifier), timeVirtual,
floating_speakers.media_printer(us, yahoo, primaryPhp)));
friendly_metal_flatbed(cd, isoPrimaryStorage(reader), dmaMirrored);
if (parse_flash_cron.metalGif(1, adServiceDevice, utility)) {
adf -= operation_cdma_samba;
imapGif.switch += torrent;
} else {
pmu.disk_captcha = digital_ppp_pci + recursionTransistor(5, dram);
ajax_service += grayscalePythonLock;
google_scroll_capacity = ftp + engine_dslam_sidebar / tape - 1;
}
drive_rw = zipTftp;
var suffix = software_router_extension.dimm_ddr(-5,
kernel_digital_minisite);
Vocavit toto; alas **mitis** maestus in liquidarum ab legi finitimosque dominam
tibi subitus; Orionis vertitur nota. Currere alti etiam seroque cernitis
innumeris miraturus amplectique collo sustinet quemque! Litora ante turba?

View File

@ -5,7 +5,7 @@ type: docs
# Acerbo datus maxime
{{< columns >}}
{{% columns %}}
## Astris ipse furtiva
Est in vagis et Pittheus tu arge accipiter regia iram vocatur nurus. Omnes ut
@ -19,7 +19,7 @@ modo arsit? Utinam rapta fiducia valuere litora _adicit cursu_, ad facies
Ea _furtique_ risere fratres edidit terrae magis. Colla tam mihi tenebat:
miseram excita suadent es pecudes iam. Concilio _quam_ velatus posset ait quod
nunc! Fragosis suae dextra geruntur functus vulgata.
{{< /columns >}}
{{% /columns %}}
## Tempora nisi nunc

View File

@ -9,5 +9,5 @@ Buttons are styled links that can lead to local page or external link.
{{</* button href="https://github.com/alex-shpak/hugo-book" */>}}Contribute{{</* /button */>}}
```
{{< button relref="/" >}}Get Home{{< /button >}}
{{< button href="https://github.com/alex-shpak/hugo-book" >}}Contribute{{< /button >}}
{{<button relref="/">}}Get Home{{</button>}}
{{<button href="https://github.com/alex-shpak/hugo-book">}}Contribute{{</button>}}

View File

@ -0,0 +1,80 @@
# Columns
Columns help organize shorter pieces of content horizontally for readability.
## Example
```html
{{%/* columns [ratio="1:1"] [class="..."] */%}} <!-- begin columns block -->
# Left Content
Lorem markdownum insigne...
<---> <!-- magic separator, between columns -->
# Mid Content
Lorem markdownum insigne...
<---> <!-- magic separator, between columns -->
# Right Content
Lorem markdownum insigne...
{{%/* /columns */%}}
```
{{% columns %}}
### Left Content
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
protulit, sed sed aere valvis inhaesuro Pallas animam: qui _quid_, ignes.
Miseratus fonte Ditis conubia.
<--->
### Mid Content
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
stringit, frustra Saturnius uteroque inter!
<--->
### Right Content
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
protulit, sed sed aere valvis inhaesuro Pallas animam: qui _quid_, ignes.
Miseratus fonte Ditis conubia.
{{% /columns %}}
## Settings size ratio for columns
```html
{{%/* columns ratio="1:2" */%}} <!-- begin columns block -->
## x1 Column
Lorem markdownum insigne...
<---> <!-- magic separator, between columns -->
## x2 Column
Lorem markdownum insigne...
{{%/* /columns */%}}
```
{{% columns ratio="1:2" %}}
### x1 Column
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
protulit, sed sed aere valvis inhaesuro Pallas animam: qui _quid_, ignes.
Miseratus fonte Ditis conubia.
<--->
### x2 Column
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
stringit, frustra Saturnius uteroque inter!
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
protulit, sed sed aere valvis inhaesuro Pallas animam: qui _quid_, ignes.
Miseratus fonte Ditis conubia.
{{% /columns %}}

View File

@ -4,19 +4,19 @@ Details shortcode is a helper for `details` html5 element. It is going to replac
## Example
```tpl
{{</* details "Title" [open] */>}}
{{%/* details "Title" [open] */%}}
## Markdown content
Lorem markdownum insigne...
{{</* /details */>}}
{{%/* /details */%}}
```
```tpl
{{</* details title="Title" open=true */>}}
{{%/* details title="Title" open=true */%}}
## Markdown content
Lorem markdownum insigne...
{{</* /details */>}}
{{%/* /details */%}}
```
{{< details "Title" open >}}
{{% details "Title" open %}}
## Markdown content
Lorem markdownum insigne...
{{< /details >}}
{{% /details %}}

View File

@ -4,29 +4,29 @@ Hint shortcode can be used as hint/alerts/notification block.
There are 3 colors to choose: `info`, `warning` and `danger`.
```tpl
{{</* hint [info|warning|danger] */>}}
{{%/* hint [info|warning|danger] */%}}
**Markdown content**
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
{{</* /hint */>}}
{{%/* /hint */%}}
```
## Example
{{< hint info >}}
{{% hint info %}}
**Markdown content**
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
{{< /hint >}}
{{% /hint %}}
{{< hint warning >}}
{{% hint warning %}}
**Markdown content**
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
{{< /hint >}}
{{% /hint %}}
{{< hint danger >}}
{{% hint danger %}}
**Markdown content**
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
{{< /hint >}}
{{% /hint %}}

View File

@ -1,28 +1,31 @@
---
title: KaTeX
---
# KaTeX
KaTeX shortcode let you render math typesetting in markdown document. See [KaTeX](https://katex.org/)
## Example
{{< columns >}}
{{% columns %}}
```latex
{{</* katex [display] [class="text-center"] */>}}
{{</* katex display=true >}}
f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
{{</* /katex */>}}
{{< /katex */>}}
```
<--->
{{< katex display >}}
{{< katex display=true >}}
f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
{{< /katex >}}
{{< /columns >}}
{{% /columns %}}
## Display Mode Example
Here is some inline example: {{< katex >}}\pi(x){{< /katex >}}, rendered in the same line. And below is `display` example, having `display: block`
{{< katex display >}}
{{< katex display=true >}}
f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
{{< /katex >}}
Text continues here.

View File

@ -0,0 +1,42 @@
# Mermaid Chart
[MermaidJS](https://mermaid-js.github.io/) is library for generating svg charts and diagrams from text.
{{% hint info %}}
**Override Mermaid initialization config**
To override the [initialization config](https://mermaid-js.github.io/mermaid/#/Setup) for Mermaid,
create a `mermaid.json` file in your `assets` folder!
{{% /hint %}}
## Example
{{% columns %}}
```tpl
{{</* mermaid [class="..."] >}}
stateDiagram-v2
State1: The state with a note
note right of State1
Important information! You can write
notes.
end note
State1 --> State2
note left of State2 : This is the note to the left.
{{< /mermaid */>}}
```
<--->
{{<mermaid>}}
stateDiagram-v2
State1: The state with a note
note right of State1
Important information! You can write
notes.
end note
State1 --> State2
note left of State2 : This is the note to the left.
{{</mermaid>}}
{{% /columns %}}

View File

@ -0,0 +1,16 @@
---
bookCollapseSection: true
bookHidden: true
---
# Section
Section renders pages in section as definition list, using title and description. Optional param `summary` can be used to show or hide page summary
## Example
```tpl
{{</* section [summary] */>}}
```
{{<section summary>}}

View File

@ -0,0 +1,6 @@
# First page
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
<!--more-->
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

View File

@ -0,0 +1,6 @@
# Second Page
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
<!--more-->
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

View File

@ -3,17 +3,18 @@
Tabs let you organize content by context, for example installation instructions for each supported platform.
```tpl
{{</* tabs "uniqueid" */>}}
{{</* tab "MacOS" */>}} # MacOS Content {{</* /tab */>}}
{{</* tab "Linux" */>}} # Linux Content {{</* /tab */>}}
{{</* tab "Windows" */>}} # Windows Content {{</* /tab */>}}
{{</* tabs "id" */>}}
{{%/* tab "MacOS" */%}} # MacOS Content {{%/* /tab */%}}
{{%/* tab "Linux" */%}} # Linux Content {{%/* /tab */%}}
{{%/* tab "Windows" */%}} # Windows Content {{%/* /tab */%}}
{{</* /tabs */>}}
```
## Example
{{< tabs "uniqueid" >}}
{{< tab "MacOS" >}}
{{< tabs >}}
{{% tab "MacOS" %}}
# MacOS
This is tab **MacOS** content.
@ -22,10 +23,9 @@ Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
protulit, sed sed aere valvis inhaesuro Pallas animam: qui _quid_, ignes.
Miseratus fonte Ditis conubia.
{{< /tab >}}
{{< tab "Linux" >}}
{{% /tab %}}
{{% tab "Linux" %}}
# Linux
This is tab **Linux** content.
@ -34,10 +34,9 @@ Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
protulit, sed sed aere valvis inhaesuro Pallas animam: qui _quid_, ignes.
Miseratus fonte Ditis conubia.
{{< /tab >}}
{{< tab "Windows" >}}
{{% /tab %}}
{{% tab "Windows" %}}
# Windows
This is tab **Windows** content.
@ -46,5 +45,6 @@ Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
protulit, sed sed aere valvis inhaesuro Pallas animam: qui _quid_, ignes.
Miseratus fonte Ditis conubia.
{{< /tab >}}
{{% /tab %}}
{{< /tabs >}}

View File

@ -0,0 +1,41 @@
---
title: Introduction
type: docs
---
# Example of RTL page
{{% columns %}}
## Astris ipse furtiva
Est in vagis et Pittheus tu arge accipiter regia iram vocatur nurus. Omnes ut
olivae sensit **arma sorori** deducit, inesset **crudus**, ego vetuere aliis,
modo arsit? Utinam rapta fiducia valuere litora _adicit cursu_, ad facies
<--->
## Suis quot vota
Ea _furtique_ risere fratres edidit terrae magis. Colla tam mihi tenebat:
miseram excita suadent es pecudes iam. Concilio _quam_ velatus posset ait quod
nunc! Fragosis suae dextra geruntur functus vulgata.
{{% /columns %}}
## Tempora nisi nunc
Lorem **markdownum** emicat gestu. Cannis sol pressit ducta. **Est** Idaei,
tremens ausim se tutaeque, illi ulnis hausit, sed, lumina cutem. Quae avis
sequens!
var panel = ram_design;
if (backup + system) {
file.readPoint = network_native;
sidebar_engine_device(cell_tftp_raster,
dual_login_paper.adf_vci.application_reader_design(
graphicsNvramCdma, lpi_footer_snmp, integer_model));
}
## Locis suis novi cum suoque decidit eadem
Idmoniae ripis, at aves, ali missa adest, ut _et autem_, et ab?

View File

@ -1,79 +0,0 @@
---
title: Введение
type: docs
---
# Стартовая страница на русском языке
{{< columns >}}
## Astris ipse furtiva
Est in vagis et Pittheus tu arge accipiter regia iram vocatur nurus. Omnes ut
olivae sensit **arma sorori** deducit, inesset **crudus**, ego vetuere aliis,
modo arsit? Utinam rapta fiducia valuere litora _adicit cursu_, ad facies
<--->
## Suis quot vota
Ea _furtique_ risere fratres edidit terrae magis. Colla tam mihi tenebat:
miseram excita suadent es pecudes iam. Concilio _quam_ velatus posset ait quod
nunc! Fragosis suae dextra geruntur functus vulgata.
{{< /columns >}}
## Tempora nisi nunc
Lorem **markdownum** emicat gestu. Cannis sol pressit ducta. **Est** Idaei,
tremens ausim se tutaeque, illi ulnis hausit, sed, lumina cutem. Quae avis
sequens!
var panel = ram_design;
if (backup + system) {
file.readPoint = network_native;
sidebar_engine_device(cell_tftp_raster,
dual_login_paper.adf_vci.application_reader_design(
graphicsNvramCdma, lpi_footer_snmp, integer_model));
}
public_keyboard_docking += error.controller_gibibyte_plug.ip(4,
asciiPetaflops, software(supercomputer_compatible_status + 4));
dynamic_disk.indexModeLaptop = bufferTftpReality;
var export_vlog_sequence = trinitron_flowchart + supercomputer_cluster_rj(
-1, toolbar_powerpoint_query, -2 / multiprocessing_impression);
## Locis suis novi cum suoque decidit eadem
Idmoniae ripis, at aves, ali missa adest, ut _et autem_, et ab? Venit spes
versus finis sermonibus patefecit murum nec est sine oculis. _Ille_ inmota
macies domoque caelestia cadit tantummodo scelus procul, corde!
1. Dolentem capi parte rostro alvum habentem pudor
2. Fulgentia sanguine paret
3. E punior consurgit lentus
4. Vox hasta eras micantes
## Facibus pharetrae indetonsusque indulsit sic incurrite foliis
Nefandam et prisci palmas! Blandita cutis flectitur montis macies, te _nati_
Latiis; turbaque inferias. Virginis tibi peracta avidusque facies caper nec, e
at ademptae, mira.
direct *= font(inputScareware(sliHome), crossplatform.byte(
ppl_encryption.excel_e_rte(integratedModelModifier), timeVirtual,
floating_speakers.media_printer(us, yahoo, primaryPhp)));
friendly_metal_flatbed(cd, isoPrimaryStorage(reader), dmaMirrored);
if (parse_flash_cron.metalGif(1, adServiceDevice, utility)) {
adf -= operation_cdma_samba;
imapGif.switch += torrent;
} else {
pmu.disk_captcha = digital_ppp_pci + recursionTransistor(5, dram);
ajax_service += grayscalePythonLock;
google_scroll_capacity = ftp + engine_dslam_sidebar / tape - 1;
}
drive_rw = zipTftp;
var suffix = software_router_extension.dimm_ddr(-5,
kernel_digital_minisite);
Vocavit toto; alas **mitis** maestus in liquidarum ab legi finitimosque dominam
tibi subitus; Orionis vertitur nota. Currere alti etiam seroque cernitis
innumeris miraturus amplectique collo sustinet quemque! Litora ante turba?

View File

@ -5,7 +5,7 @@ type: docs
# 中文索引页
{{< columns >}}
{{% columns %}}
## Astris ipse furtiva
Est in vagis et Pittheus tu arge accipiter regia iram vocatur nurus. Omnes ut
@ -19,7 +19,7 @@ modo arsit? Utinam rapta fiducia valuere litora _adicit cursu_, ad facies
Ea _furtique_ risere fratres edidit terrae magis. Colla tam mihi tenebat:
miseram excita suadent es pecudes iam. Concilio _quam_ velatus posset ait quod
nunc! Fragosis suae dextra geruntur functus vulgata.
{{< /columns >}}
{{% /columns %}}
## Tempora nisi nunc

View File

@ -1,45 +0,0 @@
# Columns
Columns help organize shorter pieces of content horizontally for readability.
```html
{{</* columns */>}} <!-- begin columns block -->
# Left Content
Lorem markdownum insigne...
<---> <!-- magic separator, between columns -->
# Mid Content
Lorem markdownum insigne...
<---> <!-- magic separator, between columns -->
# Right Content
Lorem markdownum insigne...
{{</* /columns */>}}
```
## Example
{{< columns >}}
## Left Content
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
protulit, sed sed aere valvis inhaesuro Pallas animam: qui _quid_, ignes.
Miseratus fonte Ditis conubia.
<--->
## Mid Content
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
stringit, frustra Saturnius uteroque inter!
<--->
## Right Content
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
protulit, sed sed aere valvis inhaesuro Pallas animam: qui _quid_, ignes.
Miseratus fonte Ditis conubia.
{{< /columns >}}

View File

@ -1,35 +0,0 @@
# Expand
Expand shortcode can help to decrease clutter on screen by hiding part of text. Expand content by clicking on it.
## Example
### Default
```tpl
{{</* expand */>}}
## Markdown content
Lorem markdownum insigne...
{{</* /expand */>}}
```
{{< expand >}}
## Markdown content
Lorem markdownum insigne...
{{< /expand >}}
### With Custom Label
```tpl
{{</* expand "Custom Label" "..." */>}}
## Markdown content
Lorem markdownum insigne...
{{</* /expand */>}}
```
{{< expand "Custom Label" "..." >}}
## Markdown content
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
protulit, sed sed aere valvis inhaesuro Pallas animam: qui _quid_, ignes.
Miseratus fonte Ditis conubia.
{{< /expand >}}

View File

@ -1,46 +0,0 @@
# Mermaid Chart
[Mermaid](https://mermaidjs.github.io/) is library for generating svg charts and diagrams from text.
{{< hint info >}}
**Override Mermaid Initialization Config**
To override the [initialization config](https://mermaid-js.github.io/mermaid/#/Setup) for Mermaid,
create a `mermaid.json` file in your `assets` folder!
{{< /hint >}}
## Example
{{< columns >}}
```tpl
{{</* mermaid [class="text-center"]*/>}}
sequenceDiagram
Alice->>Bob: Hello Bob, how are you?
alt is sick
Bob->>Alice: Not so good :(
else is well
Bob->>Alice: Feeling fresh like a daisy
end
opt Extra response
Bob->>Alice: Thanks for asking
end
{{</* /mermaid */>}}
```
<--->
{{< mermaid >}}
sequenceDiagram
Alice->>Bob: Hello Bob, how are you?
alt is sick
Bob->>Alice: Not so good :(
else is well
Bob->>Alice: Feeling fresh like a daisy
end
opt Extra response
Bob->>Alice: Thanks for asking
end
{{< /mermaid >}}
{{< /columns >}}

View File

@ -1,15 +0,0 @@
---
bookCollapseSection: true
---
# Section
Section renders pages in section as definition list, using title and description.
## Example
```tpl
{{</* section */>}}
```
{{<section>}}

View File

@ -1 +0,0 @@
# Page 1

View File

@ -1 +0,0 @@
# Page 2

View File

@ -1,22 +0,0 @@
---
headless: true
---
- [**Example Site**]({{< relref "/docs/example" >}})
- [Table of Contents]({{< relref "/docs/example/table-of-contents" >}})
- [With ToC]({{< relref "/docs/example/table-of-contents/with-toc" >}})
- [Without ToC]({{< relref "/docs/example/table-of-contents/without-toc" >}})
- [Collapsed]({{< relref "/docs/example/collapsed" >}})
- [3rd]({{< relref "/docs/example/collapsed/3rd-level" >}})
- [4th]({{< relref "/docs/example/collapsed/3rd-level/4th-level" >}})
<br />
- **Shortcodes**
- [Buttons]({{< relref "/docs/shortcodes/buttons" >}})
- [Columns]({{< relref "/docs/shortcodes/columns" >}})
- [Expand]({{< relref "/docs/shortcodes/expand" >}})
- [Hints]({{< relref "/docs/shortcodes/hints" >}})
- [Katex]({{< relref "/docs/shortcodes/katex" >}})
- [Mermaid]({{< relref "/docs/shortcodes/mermaid" >}})
- [Tabs]({{< relref "/docs/shortcodes/tabs" >}})
<br />

View File

@ -1,4 +1,4 @@
# hugo server --minify --themesDir ... --baseURL=http://0.0.0.0:1313/theme/hugo-book/
# hugo server --minify --themesDir ../.. --baseURL=http://0.0.0.0:1313/theme/hugo-book/
baseURL = 'https://example.com/'
title = 'Hugo Book'
@ -23,17 +23,18 @@ enableGitInfo = true
[languages]
[languages.en]
languageName = 'English'
contentDir = 'content'
contentDir = 'content.en'
weight = 1
[languages.ru]
languageName = 'Russian'
contentDir = 'content.ru'
weight = 2
[languages.zh]
languageName = 'Chinese'
contentDir = 'content.zh'
weight = 2
[languages.he]
languageName = 'Hebrew'
contentDir = 'content.he'
languageDirection = 'rtl'
weight = 3
[menu]
@ -45,7 +46,7 @@ enableGitInfo = true
[[menu.after]]
name = "Hugo Themes"
url = "https://themes.gohugo.io/hugo-book/"
url = "https://themes.gohugo.io/themes/hugo-book/"
weight = 20
[params]
@ -58,13 +59,13 @@ enableGitInfo = true
# You can also specify this parameter per page in front matter.
BookToC = true
# (Optional, default none) Set the path to a logo for the book. If the logo is
# /static/logo.png then the path would be logo.png
# BookLogo = 'logo.png'
# (Optional, default favicon.png) Set the path to a favicon file.
# If the favicon is /static/favicon.png then the path would be favicon.png
# BookFavicon = 'favicon.png'
# (Optional, default none) Set leaf bundle to render as side menu
# When not specified file structure and weights will be used
# BookMenuBundle = '/menu'
# (Optional, default none) Set the path to a logo for the book.
# If the logo is /static/logo.png then the path would be logo.png
# BookLogo = 'logo.png'
# (Optional, default docs) Specify root page to render child pages as menu.
# Page is resoled by .GetPage function: https://gohugo.io/functions/getpage/

View File

@ -1,4 +1,4 @@
# hugo server --minify --themesDir ... --baseURL=http://0.0.0.0:1313/theme/hugo-book/
# hugo server --minify --themesDir ../.. --baseURL=http://0.0.0.0:1313/theme/hugo-book/
baseURL: https://example.com/
title: Hugo Book
@ -23,15 +23,16 @@ markup:
languages:
en:
languageName: English
contentDir: content
contentDir: content.en
weight: 1
ru:
languageName: Russian
contentDir: content.ru
weight: 2
zh:
languageName: Chinese
contentDir: content.zh
weight: 2
he:
languageName: Hebrew
contentDir: content.he
languageDirection: rtl
weight: 3
menu:
@ -41,7 +42,7 @@ menu:
url: "https://github.com/alex-shpak/hugo-book"
weight: 10
- name: "Hugo Themes"
url: "https://themes.gohugo.io/hugo-book/"
url: "https://themes.gohugo.io/themes/hugo-book/"
weight: 20
params:
@ -54,13 +55,13 @@ params:
# You can also specify this parameter per page in front matter.
BookToC: true
# (Optional, default none) Set the path to a logo for the book. If the logo is
# /static/logo.png then the path would be logo.png
# BookLogo: /logo.png
# (Optional, default favicon.png) Set the path to a favicon file.
# If the favicon is /static/favicon.png then the path would be favicon.png
# BookFavicon: "favicon.png"
# (Optional, default none) Set leaf bundle to render as side menu
# When not specified file structure and weights will be used
# BookMenuBundle: /menu
# (Optional, default none) Set the path to a logo for the book.
# If the logo is /static/logo.png then the path would be logo.png
# BookLogo: /logo.png
# (Optional, default docs) Specify root page to render child pages as menu.
# Page is resoled by .GetPage function: https://gohugo.io/functions/getpage/

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
{"Target":"book.min.6c8b9d2a1fc95075ed7da46ca81060b39add8fff6741ac51259f768929281e2c.css","MediaType":"text/css","Data":{"Integrity":"sha256-bIudKh/JUHXtfaRsqBBgs5rdj/9nQaxRJZ92iSkoHiw="}}

View File

@ -1 +0,0 @@
{"Target":"book.min.5ac6c2989f0943405962be6800b442aef429ef26ade26545ecf0617a21d1197a.css","MediaType":"text/css","Data":{"Integrity":"sha256-WsbCmJ8JQ0BZYr5oALRCrvQp7yat4mVF7PBheiHRGXo="}}

3
go.mod Normal file
View File

@ -0,0 +1,3 @@
module github.com/alex-shpak/hugo-book
go 1.16

14
i18n/am.yaml Normal file
View File

@ -0,0 +1,14 @@
- id: Search
translation: ፈልግ
- id: Edit this page
translation: ይህንን ገጽ አስተካክል
- id: Last modified by
translation: መጨረሻ የከለሰው ሰው
- id: Expand
translation: አስፋ
- id: bookSearchConfig
translation: '{ cache: true }'

View File

@ -8,7 +8,7 @@
translation: Última modificación por
- id: Expand
translation: Expand
translation: Expandir
- id: bookSearchConfig
translation: '{ cache: true }'

20
i18n/fa.yaml Normal file
View File

@ -0,0 +1,20 @@
- id: Search
translation: جستجو
- id: Edit this page
translation: این صفحه را ویرایش کنید
- id: Last modified by
translation: آخرین بار ویرایش شده توسط
- id: Expand
translation: بسط دادن
- id: Categories
translation: دسته بندی ها
- id: Tags
translation: تگ ها
- id: bookSearchConfig
translation: '{ cache: true, encode: false, rtl: true, split: /\s+/, tokenize: "forward"}'

14
i18n/it.yaml Normal file
View File

@ -0,0 +1,14 @@
- id: Search
translation: Cerca
- id: Edit this page
translation: Modifica questa pagina
- id: Last modified by
translation: Ultima modifica di
- id: Expand
translation: Espandi
- id: bookSearchConfig
translation: '{ cache: true }'

14
i18n/nl.yaml Normal file
View File

@ -0,0 +1,14 @@
- id: Search
translation: Zoeken
- id: Edit this page
translation: Bewerk deze pagina
- id: Last modified by
translation: Laatst gewijzigd door
- id: Expand
translation: Uitbreiden
- id: bookSearchConfig
translation: '{ cache: true }'

14
i18n/oc.yaml Normal file
View File

@ -0,0 +1,14 @@
- id: Search
translation: Recercar
- id: Edit this page
translation: Modificar aquesta pagina
- id: Last modified by
translation: Darrièra modificacion per
- id: Expand
translation: Desplegar
- id: bookSearchConfig
translation: '{ cache: true }'

14
i18n/pl.yaml Normal file
View File

@ -0,0 +1,14 @@
- id: Search
translation: Szukaj
- id: Edit this page
translation: Edytuj stronę
- id: Last modified by
translation: Ostatnia modyfikacja
- id: Expand
translation: Rozwiń
- id: bookSearchConfig
translation: '{ cache: true }'

View File

@ -29,7 +29,6 @@
</main>
{{ partial "docs/inject/body" . }}
{{ template "_internal/google_analytics_async.html" . }}
</body>
</html>

View File

@ -1,13 +1,10 @@
<!DOCTYPE html>
<html lang="{{ .Site.Language.Lang }}" dir="{{ .Site.Language.LanguageDirection | default "ltr" }}">
<html lang="{{ default .Site.Language.Lang .Site.LanguageCode }}" dir="{{ default "ltr" .Site.Language.LanguageDirection }}">
<head>
{{ hugo.Generator }}
{{ partial "docs/html-head" . }}
{{ partial "docs/inject/head" . }}
</head>
<body dir="{{ .Site.Language.LanguageDirection | default "ltr" }}">
<body dir="{{ default "ltr" .Site.Language.LanguageDirection }}">
<input type="checkbox" class="hidden toggle" id="menu-control" />
<input type="checkbox" class="hidden toggle" id="toc-control" />
<main class="container flex">
@ -47,7 +44,6 @@
{{ partial "docs/inject/body" . }}
</body>
</html>
{{ define "menu" }}
@ -77,7 +73,7 @@
{{ end }}
{{ define "main" }}
<article class="markdown">
<article class="markdown book-article">
{{- .Content -}}
</article>
{{ end }}

View File

@ -1,7 +1,7 @@
<h2 class="book-brand">
<a href="{{ .Site.BaseURL | relLangURL }}">
<a class="flex align-center" href="{{ cond (not .Site.Home.File) .Sites.Default.Home.RelPermalink .Site.Home.RelPermalink }}">
{{- with .Site.Params.BookLogo -}}
<img src="{{ . | relURL }}" alt="Logo" />
<img src="{{ . | relURL }}" alt="Logo" class="book-icon" />
{{- end -}}
<span>{{ .Site.Title }}</span>
</a>

View File

@ -3,4 +3,4 @@
Usage: partial "docs/date" (dict "Date" .Date "Format" .Site.Params.BookDateFormat)
-->
{{- $format := default "January 2, 2006" .Format -}}
{{- return (.Date.Format $format) -}}
{{- return (time.Format $format .Date) -}}

View File

@ -1,14 +1,10 @@
<div class="flex flex-wrap justify-between">
{{ if .Site.IsMultiLingual }}
{{ partial "docs/languages" . }}
{{ end }}
{{ if and .GitInfo .Site.Params.BookRepo }}
<div>
{{- $date := partial "docs/date" (dict "Date" .GitInfo.AuthorDate.Local "Format" .Site.Params.BookDateFormat) -}}
{{- $commitPath := default "commit" .Site.Params.BookCommitPath -}}
<a class="flex align-center" href="{{ .Site.Params.BookRepo }}/{{ $commitPath }}/{{ .GitInfo.Hash }}" title='{{ i18n "Last modified by" }} {{ .GitInfo.AuthorName }} | {{ $date }}' target="_blank" rel="noopener">
<img src="{{ "svg/calendar.svg" | relURL }}" class="book-icon" alt="Calendar" />
<a class="flex align-center" href="{{ partial "docs/links/commit" . }}" title='{{ i18n "Last modified by" }} {{ .GitInfo.AuthorName }} | {{ $date }}' target="_blank" rel="noopener">
<img src="{{ "svg/calendar.svg" | relURL }}" class="book-icon" alt="" />
<span>{{ $date }}</span>
</a>
</div>
@ -16,10 +12,16 @@
{{ if and .File .Site.Params.BookRepo .Site.Params.BookEditPath }}
<div>
<a class="flex align-center" href="{{ .Site.Params.BookRepo }}/{{ .Site.Params.BookEditPath }}/{{ .Site.Params.contentDir | default "content" }}/{{ replace .File.Path "\\" "/" }}" target="_blank" rel="noopener">
<img src="{{ "svg/edit.svg" | relURL }}" class="book-icon" alt="Edit" />
<a class="flex align-center" href="{{ partial "docs/links/edit" . }}" target="_blank" rel="noopener">
<img src="{{ "svg/edit.svg" | relURL }}" class="book-icon" alt="" />
<span>{{ i18n "Edit this page" }}</span>
</a>
</div>
{{ end }}
</div>
{{ $script := resources.Get "clipboard.js" | resources.Minify }}
{{ with $script.Content }}
<script>{{ . | safeJS }}</script>
{{ end }}

View File

@ -3,7 +3,7 @@
<img src="{{ "svg/menu.svg" | relURL }}" class="book-icon" alt="Menu" />
</label>
<strong>{{ partial "docs/title" . }}</strong>
<h3>{{ partial "docs/title" . }}</h3>
<label for="toc-control">
{{ if default true (default .Site.Params.BookToC .Params.BookToC) }}

View File

@ -0,0 +1 @@
<link rel="icon" href="{{ .Site.Params.BookFavicon | default "favicon.png" | relURL }}" >

View File

@ -0,0 +1 @@
{{ partial "docs/title" . }} | {{ .Site.Title -}}

View File

@ -1,36 +1,43 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="{{ default .Summary .Description }}">
<meta name="theme-color" content="#FFFFFF">
<meta name="theme-color" media="(prefers-color-scheme: light)" content="#ffffff">
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#343a40">
<meta name="color-scheme" content="light dark">
{{- with .Page.Params.BookHref -}}
<meta http-equiv="Refresh" content="0; url='{{ . }}'" />
{{- end -}}
{{- template "_internal/opengraph.html" . -}}
<title>{{ partial "docs/title" . }} | {{ .Site.Title -}}</title>
<title>{{ partial "docs/html-head-title" . }}</title>
{{ partial "docs/html-head-favicon" . }}
{{- $manifest := resources.Get "manifest.json" | resources.ExecuteAsTemplate "manifest.json" . }}
<link rel="manifest" href="{{ $manifest.RelPermalink }}">
<link rel="icon" href="{{ "favicon.png" | relURL }}" type="image/x-icon">
<link rel="canonical" href="{{ .Permalink }}">
{{- range .Translations }}
<link rel="alternate" hreflang="{{ .Language.Lang }}" href="{{ .Permalink }}" title="{{ partial "docs/title" . }}">
{{ end -}}
<link rel="alternate" hreflang="{{ default .Site.LanguageCode .Language.Lang }}" href="{{ .Permalink }}" title="{{ partial "docs/title" . }}">
{{- end -}}
<!-- Theme stylesheet, you can customize scss by creating `assets/custom.scss` in your website -->
{{- $styles := resources.Get "book.scss" | resources.ExecuteAsTemplate "book.scss" . | resources.ToCSS | resources.Minify | resources.Fingerprint }}
<link rel="stylesheet" href="{{ $styles.RelPermalink }}" integrity="{{ $styles.Data.Integrity }}">
{{- if default true .Site.Params.BookSearch }}
{{- $searchJSFile := printf "%s.search.js" .Language.Lang }}
{{- $searchJS := resources.Get "search.js" | resources.ExecuteAsTemplate $searchJSFile . | resources.Minify | resources.Fingerprint }}
<script defer src="{{ $searchJS.RelPermalink }}" integrity="{{ $searchJS.Data.Integrity }}"></script>
{{- $styles := resources.Get "book.scss" | resources.ExecuteAsTemplate "book.scss" . | css.Sass | resources.Minify | resources.Fingerprint }}
<link rel="stylesheet" href="{{ $styles.RelPermalink }}" {{ template "integrity" $styles }}>
{{- if default true .Site.Params.BookSearch -}}
{{- $searchJSFile := printf "%s.search.js" .Language.Lang }}
{{- $searchJS := resources.Get "search.js" | resources.ExecuteAsTemplate $searchJSFile . | resources.Minify | resources.Fingerprint }}
<script defer src="{{ "fuse.min.js" | relURL }}"></script>
<script defer src="{{ $searchJS.RelPermalink }}" {{ template "integrity" $searchJS }}></script>
{{ end -}}
{{- if .Site.Params.BookServiceWorker }}
{{- $swJS := resources.Get "sw-register.js" | resources.ExecuteAsTemplate "sw.js" . | resources.Minify | resources.Fingerprint }}
<script defer src="{{ $swJS.RelPermalink }}" integrity="{{ $swJS.Data.Integrity }}"></script>
{{- if .Site.Params.BookServiceWorker -}}
{{- $swJS := resources.Get "sw-register.js" | resources.ExecuteAsTemplate "sw.js" . | resources.Minify | resources.Fingerprint }}
<script defer src="{{ $swJS.RelPermalink }}" {{ template "integrity" $swJS }}></script>
{{ end -}}
{{- template "_internal/google_analytics_async.html" . -}}
{{- template "_internal/google_analytics.html" . -}}
<!-- RSS -->
{{- with .OutputFormats.Get "rss" -}}
@ -41,3 +48,9 @@
Made with Book Theme
https://github.com/alex-shpak/hugo-book
{{ "-->" | safeHTML }}
{{- define "integrity" -}}
{{- if (urls.Parse .Permalink).Host -}}
integrity="{{ .Data.Integrity }}" crossorigin="anonymous"
{{- end -}}
{{- end -}}

View File

@ -2,7 +2,7 @@
{{ $bookTranslatedOnly := default false .Site.Params.BookTranslatedOnly }}
{{ $translations := dict }}
{{ if (eq $bookTranslatedOnly false ) }}
{{ range .Site.Home.AllTranslations }}
{{ range .Site.Home.Translations }}
{{ $translations = merge $translations (dict .Language.Lang .) }}
{{ end }}
{{ end }}
@ -10,22 +10,24 @@
{{ $translations = merge $translations (dict .Language.Lang .) }}
{{ end }}
<div class="book-languages" tabindex="0" aria-haspopup="true">
<ul>
<li class="flex align-center">
<img src="{{ "svg/translate.svg" | relURL }}" class="book-icon" alt="Languages" />
{{ $.Site.Language.LanguageName }}
</li>
</ul>
<ul class="book-languages-list">
{{ range .Site.Languages }}{{ with index $translations .Lang }}
<li class="{{ if (eq $.Site.Language .Language) }}active{{ end }}">
<a href="{{ .Permalink }}" class="flex align-center">
<ul class="book-languages">
<li>
<input type="checkbox" id="languages" class="toggle" />
<label for="languages" class="flex justify-between">
<a role="button" class="flex align-center">
<img src="{{ "svg/translate.svg" | relURL }}" class="book-icon" alt="Languages" />
{{ .Language.LanguageName }}
{{ $.Site.Language.LanguageName }}
</a>
</li>
{{ end }}{{ end }}
</ul>
</div>
</label>
<ul>
{{ range .Site.Languages }}{{ with index $translations .Lang }}
<li>
<a href="{{ cond hugo.IsMultihost .Permalink .RelPermalink }}">
{{ .Language.LanguageName }}
</a>
</li>
{{ end }}{{ end }}
</ul>
</li>
</ul>

View File

@ -0,0 +1,2 @@
{{- $commitPath := default "commit" .Site.Params.BookCommitPath -}}
{{- .Site.Params.BookRepo }}/{{ $commitPath }}/{{ .GitInfo.Hash -}}

View File

@ -0,0 +1,2 @@
{{- $bookFilePath := (strings.TrimPrefix hugo.WorkingDir .Page.File.Filename | path.Join) -}}
{{- .Site.Params.BookRepo }}/{{ .Site.Params.BookEditPath }}{{ ($bookFilePath) -}}

View File

@ -1,4 +0,0 @@
{{ with .Site.GetPage .Site.Params.BookMenuBundle }}
{{- $href := printf "href=\"%s\"" $.RelPermalink -}}
{{- replace .Content $href (print $href "class=active") | safeHTML -}}
{{ end }}

View File

@ -9,7 +9,7 @@
{{ define "book-section-children" }}{{/* (dict "Section" .Section "CurrentPage" .CurrentPage) */}}
<ul>
{{ range (where .Section.Pages "Params.bookhidden" "ne" true) }}
{{ range (where .Section.Pages "Params.bookHidden" "ne" true) }}
{{ if .IsSection }}
<li {{- if .Params.BookFlatSection }} class="book-section-flat" {{ end -}}>
{{ template "book-page-link" (dict "Page" . "CurrentPage" $.CurrentPage) }}
@ -28,15 +28,19 @@
{{ $current := eq .CurrentPage .Page }}
{{ $ancestor := .Page.IsAncestor .CurrentPage }}
{{ if .Page.Params.bookCollapseSection }}
{{ if .Page.Params.BookCollapseSection }}
<input type="checkbox" id="section-{{ md5 .Page }}" class="toggle" {{ if or $current $ancestor }}checked{{ end }} />
<label for="section-{{ md5 .Page }}" class="flex justify-between">
<a {{ if .Page.Content }}href="{{ .Page.Permalink }}"{{ end }} class="{{ if $current }}active{{ end }}">
<a {{ if .Page.Content }}href="{{ .Page.RelPermalink }}"{{ else }}role="button"{{ end }} class="{{ if $current }}active{{ end }}">
{{- partial "docs/title" .Page -}}
</a>
</label>
{{ else if .Page.Params.BookHref }}
<a href="{{ .Page.Params.BookHref }}" class="{{ if $current }}active{{ end }}" target="_blank" rel="noopener">
{{- partial "docs/title" .Page -}}
</a>
{{ else if .Page.Content }}
<a href="{{ .Page.Permalink }}" class="{{ if $current }} active{{ end }}">
<a href="{{ .Page.RelPermalink }}" class="{{ if $current }}active{{ end }}">
{{- partial "docs/title" .Page -}}
</a>
{{ else }}

View File

@ -10,7 +10,7 @@
<ul>
{{ range . }}
<li>
<a href="{{ .URL }}" {{ if not .Page }}target="_blank" rel="noopener"{{ end }}>
<a href="{{ .URL }}" {{ with .Params.class }}class="{{ . }}"{{ end }} {{ if not .Page }}target="_blank" rel="noopener"{{ end }}>
{{- .Pre -}}
{{ with .Page }}
{{ partial "docs/title" .Page }}

View File

@ -1,15 +1,14 @@
<nav>
{{ partial "docs/brand" . }}
{{ partial "docs/search" . }}
{{ if hugo.IsMultilingual }}
{{ partial "docs/languages" . }}
{{ end }}
{{ partial "docs/inject/menu-before" . }}
{{ partial "docs/menu-hugo" .Site.Menus.before }}
{{ if .Site.Params.BookMenuBundle }}
{{ partial "docs/menu-bundle" . }}
{{ else }}
{{ partial "docs/menu-filetree" . }}
{{ end }}
{{ partial "docs/menu-filetree" . }}
{{ partial "docs/menu-hugo" .Site.Menus.after }}
{{ partial "docs/inject/menu-after" . }}

View File

@ -1,23 +1,16 @@
{{ with .Date }}
<h5>{{ partial "docs/date" (dict "Date" . "Format" $.Site.Params.BookDateFormat) }}</h5>
<div class="flex align-center text-small book-post-date">
<img src="{{ "svg/calendar.svg" | relURL }}" class="book-icon " alt="" />
<span>{{ partial "docs/date" (dict "Date" . "Format" $.Site.Params.BookDateFormat) }}</span>
</div>
{{ end }}
{{ range $taxonomy, $_ := .Site.Taxonomies }}
{{ with $terms := $.GetTerms $taxonomy }}
<div>
<div class="text-small">
{{ range $n, $term := $terms }}{{ if $n }}, {{ end }}
<a href="{{ $term.RelPermalink }}">{{ $term.Title }}</a>
{{- end }}
</div>
{{ end }}
{{ end }}
{{ if .Params.image }}
<p>
{{ with .Resources.GetMatch .Params.image }}
<img src={{ .RelPermalink }} />
{{ else }}
<img src={{ .Params.image | relURL }} />
{{ end }}
</p>
{{ end }}

View File

@ -1,7 +1,8 @@
{{ if default true .Site.Params.BookSearch }}
<div class="book-search">
<div class="book-search hidden">
<input type="text" id="book-search-input" placeholder="{{ i18n "Search" }}" aria-label="{{ i18n "Search" }}" maxlength="64" data-hotkeys="s/" />
<div class="book-search-spinner hidden"></div>
<ul id="book-search-results"></ul>
</div>
<script>document.querySelector(".book-search").classList.remove("hidden")</script>
{{ end }}

View File

@ -4,7 +4,9 @@
-->
{{ $title := "" }}
{{ if .Title }}
{{ if .LinkTitle }}
{{ $title = .LinkTitle }}
{{ else if .Title }}
{{ $title = .Title }}
{{ else if and .IsSection .File }}
{{ $title = path.Base .File.Dir | humanize | title }}

View File

@ -5,12 +5,12 @@
<a href="{{ .RelPermalink }}">{{ partial "docs/title.html" . }}</a>
</h2>
{{ partial "docs/post-meta" . }}
<p>
<div class="book-post-content">
{{- .Summary -}}
{{ if .Truncated }}
<a href="{{ .RelPermalink }}">...</a>
{{ end }}
</p>
</div>
</article>
{{ end }}

View File

@ -1,10 +1,12 @@
{{ define "main" }}
<article class="markdown">
<article class="markdown book-post">
<h1>
<a href="{{ .RelPermalink }}">{{ partial "docs/title.html" . }}</a>
{{ partial "docs/title.html" . }}
</h1>
{{ partial "docs/post-meta" . }}
{{- .Content -}}
<div class="book-post-content">
{{- .Content -}}
</div>
</article>
{{ end }}

View File

@ -1,12 +1,12 @@
{{ $ref := "" }}
{{ $target := "" }}
{{ with .Get "href" }}
{{ $ref = . }}
{{ $target = "_blank" }}
{{ end }}
{{ with .Get "relref" }}
{{ $ref = relref $ . }}
{{ end }}
<a {{ with $ref }} href="{{.}}" {{ end }} {{ with $target }} target="{{.}}" {{ end }} class="book-btn{{ with .Get "class" }} {{ . }}{{ end }}">
{{ $.Inner | markdownify }}
{{- $ref := "" }}
{{- $target := "" -}}
{{- with .Get "href" -}}
{{- $ref = . -}}
{{- $target = "_blank" -}}
{{- end -}}
{{- with .Get "relref" -}}
{{- $ref = relref $ . -}}
{{- end -}}
<a {{ with $ref }} href="{{.}}" {{ end }} {{ with $target }} target="{{.}}" rel="noopener" {{ end }} class="book-btn{{ with .Get "class" }} {{ . }}{{ end }}">
{{- .InnerDeindent -}}
</a>

View File

@ -1,7 +1,9 @@
<div class="book-columns flex flex-wrap">
{{ range split .Inner "<--->" }}
<div class="flex-even markdown-inner">
{{ . | markdownify }}
{{- $ratio := (split (.Get "ratio") ":") -}}
<div class="book-columns flex flex-wrap{{ with .Get "class" }} {{ . }}{{ end }}">
{{ range $index, $content := split .InnerDeindent "<--->" }}
{{- $grow := default 1 (index $ratio $index) -}}
<div class="flex-even markdown-inner" style="flex-grow: {{ $grow }};">
{{ $content | safeHTML }}
</div>
{{ end }}
{{ end }}
</div>

View File

@ -1,6 +1,7 @@
<details {{ if or (.Get "open") (in .Params "open") }}open{{ end }}>
<summary>{{ cond .IsNamedParams (.Get "title") (.Get 0) }}</summary>
{{- $summary := cond .IsNamedParams (.Get "title") (.Get 0) -}}
<summary>{{ $summary }}</summary>
<div class="markdown-inner">
{{ .Inner | markdownify }}
{{ .InnerDeindent | safeHTML }}
</div>
</details>

View File

@ -1,13 +0,0 @@
{{ warnf "Expand shortcode is deprecated. Use 'details' instead." }}
<div class="book-expand">
<label>
<div class="book-expand-head flex justify-between">
<span>{{ default (i18n "Expand") (.Get 0) }}</span>
<span>{{ default "↕" (.Get 1) }}</span>
</div>
<input type="checkbox" class="hidden" />
<div class="book-expand-content markdown-inner">
{{ .Inner | markdownify }}
</div>
</label>
</div>

View File

@ -1,3 +1,3 @@
<blockquote class="book-hint {{ .Get 0 }}">
{{ .Inner | markdownify }}
{{ .Inner | safeHTML }}
</blockquote>

View File

@ -0,0 +1 @@
{{- .Inner | safeHTML -}}

View File

@ -0,0 +1,2 @@
{{- $content := .Get 0 -}}
{{- default $content (i18n $content) -}}

View File

@ -1,5 +1,5 @@
{{- if not (.Page.Scratch.Get "katex") -}}
<!-- Include katext only first time -->
<!-- Include katex only first time -->
<link rel="stylesheet" href="{{ "katex/katex.min.css" | relURL }}" />
<script defer src="{{ "katex/katex.min.js" | relURL }}"></script>
<script defer src="{{ "katex/auto-render.min.js" | relURL }}" onload="renderMathInElement(document.body);"></script>
@ -7,7 +7,7 @@
{{- end -}}
<span {{- with .Get "class" }} class="{{ . }}"{{ end }}>
{{ cond (in .Params "display") "\\[" "\\(" -}}
{{- trim .Inner "\n" -}}
{{- cond (in .Params "display") "\\]" "\\)" }}
{{ with .Get "display" }}\[{{else}}\({{end}}
{{- .InnerDeindent -}}
{{ with .Get "display" }}\]{{else}}\){{end}}
</span>

View File

@ -7,6 +7,6 @@
{{ .Page.Scratch.Set "mermaid" true }}
{{ end }}
<p class="mermaid{{ with .Get "class" }} {{ . }}{{ end }}">
<pre class="mermaid{{ with .Get "class" }} {{ . }}{{ end }}">
{{- .Inner -}}
</p>
</pre>

View File

@ -1,10 +1,13 @@
{{- warnf "Section shortcode is deprecated and will be removed" -}}
<dl>
{{ range .Page.Pages }}
<dt>
<a href="{{ .RelPermalink }}">{{ partial "docs/title" . }}</a>
</dt>
<dd>
{{ if (in $.Params "summary") -}}
<dd class="markdown-inner">
{{ default .Summary .Description }}
</dd>
{{ end -}}
{{ end }}
</dl>

Some files were not shown because too many files have changed in this diff Show More