Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanJField committed Apr 2, 2024
2 parents 2cc737d + 2dffe0b commit 5a4fcb4
Show file tree
Hide file tree
Showing 16 changed files with 1,136 additions and 643 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- 'latest'
- '0.79.0'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true # Fetch Hugo themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
Expand Down
6 changes: 3 additions & 3 deletions assets/manifest.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
Expand Down
4 changes: 2 additions & 2 deletions assets/plugins/_numbered.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$startLevel: 1;
$endLevel: 6;

.book-page .markdown {
.book-page .markdown.book-article {
@for $currentLevel from $startLevel through $endLevel {
> h#{$currentLevel} {
counter-increment: h#{$currentLevel};
Expand All @@ -19,7 +19,7 @@ $endLevel: 6;
}
}

.book-toc nav ul {
.book-toc nav#TableOfContents ul {
li {
counter-increment: item;

Expand Down
2 changes: 1 addition & 1 deletion assets/sw-register.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
if (navigator.serviceWorker) {
navigator.serviceWorker.register(
"{{ $swJS.RelPermalink }}",
{ scope: "{{ "/" | relURL }}" }
{ scope: "{{ "./" | relURL }}" }
);
}
2 changes: 1 addition & 1 deletion exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,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]
Expand Down
2 changes: 1 addition & 1 deletion exampleSite/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,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:
Expand Down
21 changes: 14 additions & 7 deletions exampleSite/content.en/docs/shortcodes/katex.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,35 @@
---
title: KaTeX
---
# KaTeX

KaTeX shortcode let you render math typesetting in markdown document. See [KaTeX](https://katex.org/)

## Example
{{< columns >}}

<div class="book-columns flex flex-wrap">
<div class="flex-even markdown-inner">

```latex
{{</*/* katex [display] [class="text-center"] */*/>}}
{{</* katex display=true class="optional" >}}
f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
{{</*/* /katex */*/>}}
{{< /katex */>}}
```

<--->
</div>
<div class="flex-even markdown-inner">

{{< katex display >}}
{{< katex display=true class="optional" >}}
f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
{{< /katex >}}

{{< /columns >}}
</div>
</div>

## 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.
17 changes: 11 additions & 6 deletions exampleSite/content.en/docs/shortcodes/mermaid.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ create a `mermaid.json` file in your `assets` folder!

## Example

{{< columns >}}

<div class="book-columns flex flex-wrap">
<div class="flex-even markdown-inner">

```tpl
{{</*/* mermaid [class="text-center"]*/*/>}}
{{</* mermaid class="optional" >}}
stateDiagram-v2
State1: The state with a note
note right of State1
Expand All @@ -22,12 +25,13 @@ stateDiagram-v2
end note
State1 --> State2
note left of State2 : This is the note to the left.
{{</*/* /mermaid */*/>}}
{{< /mermaid */>}}
```

<--->
</div>
<div class="flex-even markdown-inner">

{{< mermaid >}}
{{< mermaid class="optional" >}}
stateDiagram-v2
State1: The state with a note
note right of State1
Expand All @@ -38,4 +42,5 @@ stateDiagram-v2
note left of State2 : This is the note to the left.
{{< /mermaid >}}

{{< /columns >}}
</div>
</div>
2 changes: 1 addition & 1 deletion exampleSite/content.en/menu/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ headless: true
- [Columns]({{< relref "/docs/shortcodes/columns" >}})
- [Expand]({{< relref "/docs/shortcodes/expand" >}})
- [Hints]({{< relref "/docs/shortcodes/hints" >}})
- [KaTex]({{< relref "/docs/shortcodes/katex" >}})
- [KaTeX]({{< relref "/docs/shortcodes/katex" >}})
- [Mermaid]({{< relref "/docs/shortcodes/mermaid" >}})
- [Tabs]({{< relref "/docs/shortcodes/tabs" >}})
<br />
2 changes: 1 addition & 1 deletion layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
{{ end }}

{{ define "main" }}
<article class="markdown">
<article class="markdown book-article">
{{- .Content -}}
</article>
{{ end }}
Expand Down
3 changes: 2 additions & 1 deletion layouts/partials/docs/html-head.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@

{{- $manifest := resources.Get "manifest.json" | resources.ExecuteAsTemplate "manifest.json" . }}
<link rel="manifest" href="{{ $manifest.RelPermalink }}">
<link rel="icon" href="{{ .Params.BookFavicon | default "favicon.png" | relURL }}" >
<link rel="icon" href="{{ .Site.Params.BookFavicon | default "favicon.png" | relURL }}" >
<link rel="canonical" href="{{ .Permalink }}">

{{- range .Translations }}
<link rel="alternate" hreflang="{{ default .Language.Lang .Site.LanguageCode }}" href="{{ .Permalink }}" title="{{ partial "docs/title" . }}">
Expand Down
2 changes: 1 addition & 1 deletion layouts/posts/single.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ define "main" }}
<article class="markdown">
<article class="markdown book-post">
<h1>
<a href="{{ .RelPermalink }}">{{ partial "docs/title.html" . }}</a>
</h1>
Expand Down
1 change: 1 addition & 0 deletions layouts/shortcodes/html.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{- .Inner -}}
6 changes: 3 additions & 3 deletions layouts/shortcodes/katex.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{{- 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>
{{- .Page.Scratch.Set "katex" true -}}
{{- end -}}

<span {{- with .Get "class" }} class="{{ . }}"{{ end }}>
{{ cond (in .Params "display") "\\[" "\\(" -}}
{{ with .Get "display" }}\[{{else}}\({{end}}
{{- trim .Inner "\n" -}}
{{- cond (in .Params "display") "\\]" "\\)" }}
{{ with .Get "display" }}\]{{else}}\){{end}}
</span>
2 changes: 1 addition & 1 deletion layouts/taxonomy/list.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ define "main" }}
<article class="markdown">
<article class="markdown book-post">
<h1>{{ .Title | title }}</h1>
{{ $taxonomies := index .Site.Taxonomies .Page.Type }}
{{ range $taxonomies }}
Expand Down
1,705 changes: 1,092 additions & 613 deletions static/mermaid.min.js

Large diffs are not rendered by default.

0 comments on commit 5a4fcb4

Please sign in to comment.