mirror of
https://github.com/imfing/hextra.git
synced 2025-07-01 19:07:10 -04:00
Compare commits
13 Commits
61-buttons
...
v0.7.0
Author | SHA1 | Date | |
---|---|---|---|
d58a8b5469 | |||
64ac97b2d6 | |||
27c976bcc1 | |||
d675d3bc7b | |||
456c96921a | |||
c2d7ba8ce5 | |||
8801a04ebe | |||
21b0acdec5 | |||
c0a1bc32dd | |||
4ea18168e3 | |||
23c84e124c | |||
678f0b86ee | |||
defc9bc11b |
@ -634,6 +634,9 @@ video {
|
|||||||
.ml-4 {
|
.ml-4 {
|
||||||
margin-left: 1rem;
|
margin-left: 1rem;
|
||||||
}
|
}
|
||||||
|
.mr-1 {
|
||||||
|
margin-right: 0.25rem;
|
||||||
|
}
|
||||||
.mr-2 {
|
.mr-2 {
|
||||||
margin-right: 0.5rem;
|
margin-right: 0.5rem;
|
||||||
}
|
}
|
||||||
@ -848,6 +851,9 @@ video {
|
|||||||
.flex-col {
|
.flex-col {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
.flex-wrap {
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
.items-start {
|
.items-start {
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
}
|
}
|
||||||
@ -878,6 +884,17 @@ video {
|
|||||||
.gap-4 {
|
.gap-4 {
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
}
|
}
|
||||||
|
.gap-x-1 {
|
||||||
|
-moz-column-gap: 0.25rem;
|
||||||
|
column-gap: 0.25rem;
|
||||||
|
}
|
||||||
|
.gap-x-1\.5 {
|
||||||
|
-moz-column-gap: 0.375rem;
|
||||||
|
column-gap: 0.375rem;
|
||||||
|
}
|
||||||
|
.gap-y-2 {
|
||||||
|
row-gap: 0.5rem;
|
||||||
|
}
|
||||||
.overflow-auto {
|
.overflow-auto {
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
@ -1408,9 +1425,6 @@ video {
|
|||||||
-webkit-hyphens: auto;
|
-webkit-hyphens: auto;
|
||||||
hyphens: auto;
|
hyphens: auto;
|
||||||
}
|
}
|
||||||
.\[text-underline-position\:from-font\] {
|
|
||||||
text-underline-position: from-font;
|
|
||||||
}
|
|
||||||
.\[transition\:background-color_1\.5s_ease\] {
|
.\[transition\:background-color_1\.5s_ease\] {
|
||||||
transition: background-color 1.5s ease;
|
transition: background-color 1.5s ease;
|
||||||
}
|
}
|
||||||
@ -2735,6 +2749,9 @@ body {
|
|||||||
--tw-rotate: 90deg;
|
--tw-rotate: 90deg;
|
||||||
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
||||||
}
|
}
|
||||||
|
.group:hover .group-hover\:underline {
|
||||||
|
text-decoration-line: underline;
|
||||||
|
}
|
||||||
.group\/code:hover .group-hover\/code\:opacity-100 {
|
.group\/code:hover .group-hover\/code\:opacity-100 {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
@ -33,8 +33,8 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
// Add click event listener for copy button
|
// Add click event listener for copy button
|
||||||
button.addEventListener('click', function (e) {
|
button.addEventListener('click', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const targetId = button.getAttribute('data-clipboard-target');
|
// Get the code target
|
||||||
const target = document.querySelector(targetId);
|
const target = button.parentElement.previousElementSibling;
|
||||||
let codeElement;
|
let codeElement;
|
||||||
if (target.tagName === 'CODE') {
|
if (target.tagName === 'CODE') {
|
||||||
codeElement = target;
|
codeElement = target;
|
||||||
@ -44,9 +44,12 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
codeElement = codeElements[codeElements.length - 1];
|
codeElement = codeElements[codeElements.length - 1];
|
||||||
}
|
}
|
||||||
if (codeElement) {
|
if (codeElement) {
|
||||||
|
let code = codeElement.innerText;
|
||||||
// Replace double newlines with single newlines in the innerText
|
// Replace double newlines with single newlines in the innerText
|
||||||
// as each line inside <span> has trailing newline '\n'
|
// as each line inside <span> has trailing newline '\n'
|
||||||
const code = codeElement.innerText.replace(/\n\n/g, '\n');
|
if ("lang" in codeElement.dataset) {
|
||||||
|
code = code.replace(/\n\n/g, '\n');
|
||||||
|
}
|
||||||
navigator.clipboard.writeText(code).then(function () {
|
navigator.clipboard.writeText(code).then(function () {
|
||||||
button.classList.add('copied');
|
button.classList.add('copied');
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
|
@ -2,8 +2,12 @@
|
|||||||
title: Markdown Syntax Guide
|
title: Markdown Syntax Guide
|
||||||
date: 2020-01-01
|
date: 2020-01-01
|
||||||
authors:
|
authors:
|
||||||
- name: John Doe
|
- name: imfing
|
||||||
link: https://example.com/johndoe
|
link: https://github.com/imfing
|
||||||
|
image: https://github.com/imfing.png
|
||||||
|
- name: Octocat
|
||||||
|
link: https://github.com/octocat
|
||||||
|
image: https://github.com/octocat.png
|
||||||
tags:
|
tags:
|
||||||
- Markdown
|
- Markdown
|
||||||
- Example
|
- Example
|
||||||
|
@ -47,8 +47,8 @@ The primary color of the theme can be customized by setting the `--primary-hue`
|
|||||||
|
|
||||||
List of available syntax highlighting themes are available at [Chroma Styles Gallery](https://xyproto.github.io/splash/docs/all.html). The stylesheet can be generated using the command:
|
List of available syntax highlighting themes are available at [Chroma Styles Gallery](https://xyproto.github.io/splash/docs/all.html). The stylesheet can be generated using the command:
|
||||||
|
|
||||||
```bash
|
```shell
|
||||||
$ hugo gen chromastyles --style=github
|
hugo gen chromastyles --style=github
|
||||||
```
|
```
|
||||||
|
|
||||||
To override the default syntax highlighting theme, we can add the generated styles to the custom CSS file.
|
To override the default syntax highlighting theme, we can add the generated styles to the custom CSS file.
|
||||||
@ -70,4 +70,4 @@ For further information, refer to the [Hugo Templates](https://gohugo.io/templat
|
|||||||
|
|
||||||
## Further Customization
|
## Further Customization
|
||||||
|
|
||||||
Didn't find what you were looking for? Feel free to [open an issue](https://github.com/imfing/hextra/issues) or make a contribution to the theme!
|
Didn't find what you were looking for? Feel free to [open a discussion](https://github.com/imfing/hextra/discussions) or make a contribution to the theme!
|
||||||
|
@ -43,18 +43,18 @@ Before starting, you need to have the following software installed:
|
|||||||
### Initialize a new Hugo site
|
### Initialize a new Hugo site
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ hugo new site my-site --format=yaml
|
hugo new site my-site --format=yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
### Configure Hextra theme via module
|
### Configure Hextra theme via module
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
# initialize hugo module
|
# initialize hugo module
|
||||||
$ cd my-site
|
cd my-site
|
||||||
$ hugo mod init github.com/username/my-site
|
hugo mod init github.com/username/my-site
|
||||||
|
|
||||||
# add Hextra theme
|
# add Hextra theme
|
||||||
$ hugo mod get github.com/imfing/hextra
|
hugo mod get github.com/imfing/hextra
|
||||||
```
|
```
|
||||||
|
|
||||||
Configure `hugo.yaml` to use Hextra theme by adding the following:
|
Configure `hugo.yaml` to use Hextra theme by adding the following:
|
||||||
@ -70,14 +70,14 @@ module:
|
|||||||
Create new content page for the home page and the documentation page:
|
Create new content page for the home page and the documentation page:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ hugo new content/_index.md
|
hugo new content/_index.md
|
||||||
$ hugo new content/docs/_index.md
|
hugo new content/docs/_index.md
|
||||||
```
|
```
|
||||||
|
|
||||||
### Preview the site locally
|
### Preview the site locally
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ hugo server --buildDrafts --disableFastRender
|
hugo server --buildDrafts --disableFastRender
|
||||||
```
|
```
|
||||||
|
|
||||||
Voila, your new site preview is available at `http://localhost:1313/`.
|
Voila, your new site preview is available at `http://localhost:1313/`.
|
||||||
@ -90,7 +90,7 @@ Voila, your new site preview is available at `http://localhost:1313/`.
|
|||||||
To update all Hugo modules in your project to their latest versions, run the following command:
|
To update all Hugo modules in your project to their latest versions, run the following command:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ hugo mod get -u
|
hugo mod get -u
|
||||||
```
|
```
|
||||||
|
|
||||||
To update Hextra to the [latest released version](https://github.com/imfing/hextra/releases), run the following command:
|
To update Hextra to the [latest released version](https://github.com/imfing/hextra/releases), run the following command:
|
||||||
@ -119,7 +119,7 @@ Before starting, you need to have the following software installed:
|
|||||||
### Initialize a new Hugo site
|
### Initialize a new Hugo site
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ hugo new site my-site --format=yaml
|
hugo new site my-site --format=yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
### Add Hextra theme as a Git submodule
|
### Add Hextra theme as a Git submodule
|
||||||
@ -139,14 +139,14 @@ theme: hextra
|
|||||||
Create new content page for the home page and the documentation page:
|
Create new content page for the home page and the documentation page:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ hugo new content/_index.md
|
hugo new content/_index.md
|
||||||
$ hugo new content/docs/_index.md
|
hugo new content/docs/_index.md
|
||||||
```
|
```
|
||||||
|
|
||||||
### Preview the site locally
|
### Preview the site locally
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ hugo server --buildDrafts --disableFastRender
|
hugo server --buildDrafts --disableFastRender
|
||||||
```
|
```
|
||||||
|
|
||||||
Your new site preview is available at `http://localhost:1313/`.
|
Your new site preview is available at `http://localhost:1313/`.
|
||||||
@ -168,7 +168,7 @@ Failure to run this command results in the theme folder not being populated with
|
|||||||
To update all submodules in your repository to their latest commits, run the following command:
|
To update all submodules in your repository to their latest commits, run the following command:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ git submodule update --remote
|
git submodule update --remote
|
||||||
```
|
```
|
||||||
|
|
||||||
To update Hextra to the latest commit, run the following command:
|
To update Hextra to the latest commit, run the following command:
|
||||||
|
@ -90,6 +90,16 @@ params:
|
|||||||
For the main sidebar, it is automatically generated from the structure of the content directory.
|
For the main sidebar, it is automatically generated from the structure of the content directory.
|
||||||
See the [Organize Files](/docs/guide/organize-files) page for more details.
|
See the [Organize Files](/docs/guide/organize-files) page for more details.
|
||||||
|
|
||||||
|
To exclude a single page from the left sidebar, set the `sidebar.exclude` parameter in the front matter of the page:
|
||||||
|
|
||||||
|
```yaml {filename="content/docs/guide/configuration.md"}
|
||||||
|
---
|
||||||
|
title: Configuration
|
||||||
|
sidebar:
|
||||||
|
exclude: true
|
||||||
|
---
|
||||||
|
```
|
||||||
|
|
||||||
### Extra Links
|
### Extra Links
|
||||||
|
|
||||||
Sidebar extra links are defined under the `menu.sidebar` section in the config file:
|
Sidebar extra links are defined under the `menu.sidebar` section in the config file:
|
||||||
|
@ -24,7 +24,7 @@ This will be hidden by default.
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
````
|
````markdown
|
||||||
{{%/* details title="Details" */%}}
|
{{%/* details title="Details" */%}}
|
||||||
|
|
||||||
This is the content of the details.
|
This is the content of the details.
|
||||||
@ -34,7 +34,7 @@ Markdown is **supported**.
|
|||||||
{{%/* /details */%}}
|
{{%/* /details */%}}
|
||||||
````
|
````
|
||||||
|
|
||||||
````
|
````markdown
|
||||||
{{%/* details title="Click me to reveal" closed="true" */%}}
|
{{%/* details title="Click me to reveal" closed="true" */%}}
|
||||||
|
|
||||||
This will be hidden by default.
|
This will be hidden by default.
|
||||||
|
@ -14,5 +14,5 @@ Open source projects powered by Hextra.
|
|||||||
{{< cards >}}
|
{{< cards >}}
|
||||||
{{< card link="https://getporter.org/" title="Porter" image="https://repository-images.githubusercontent.com/155893691/aa249c80-fcf3-11ea-93b0-30079e8d7de4" imageStyle="object-fit:cover; aspect-ratio:16/9;" >}}
|
{{< card link="https://getporter.org/" title="Porter" image="https://repository-images.githubusercontent.com/155893691/aa249c80-fcf3-11ea-93b0-30079e8d7de4" imageStyle="object-fit:cover; aspect-ratio:16/9;" >}}
|
||||||
{{< card link="https://lutheranconfessions.org/" title="LutheranConfessions" image="https://github.com/imfing/hextra/assets/5097752/ad6625e4-88cd-4cad-b102-5399997d0359" imageStyle="object-fit:cover; aspect-ratio:16/9;" >}}
|
{{< card link="https://lutheranconfessions.org/" title="LutheranConfessions" image="https://github.com/imfing/hextra/assets/5097752/ad6625e4-88cd-4cad-b102-5399997d0359" imageStyle="object-fit:cover; aspect-ratio:16/9;" >}}
|
||||||
{{< card link="/" title="Hextra Starter Template" image="https://user-images.githubusercontent.com/5097752/263551418-c403b9a9-a76c-47a6-8466-513d772ef0b7.jpg" imageStyle="object-fit:cover; aspect-ratio:16/9;" >}}
|
{{< card link="https://github.com/imfing/hextra-starter-template/" title="Hextra Starter Template" image="https://user-images.githubusercontent.com/5097752/263551418-c403b9a9-a76c-47a6-8466-513d772ef0b7.jpg" imageStyle="object-fit:cover; aspect-ratio:16/9;" >}}
|
||||||
{{< /cards >}}
|
{{< /cards >}}
|
||||||
|
@ -66,7 +66,6 @@
|
|||||||
"[-webkit-touch-callout:none]",
|
"[-webkit-touch-callout:none]",
|
||||||
"[counter-reset:step]",
|
"[counter-reset:step]",
|
||||||
"[hyphens:auto]",
|
"[hyphens:auto]",
|
||||||
"[text-underline-position:from-font]",
|
|
||||||
"[transition:background-color_1.5s_ease]",
|
"[transition:background-color_1.5s_ease]",
|
||||||
"[word-break:break-word]",
|
"[word-break:break-word]",
|
||||||
"absolute",
|
"absolute",
|
||||||
@ -241,6 +240,7 @@
|
|||||||
"fixed",
|
"fixed",
|
||||||
"flex",
|
"flex",
|
||||||
"flex-col",
|
"flex-col",
|
||||||
|
"flex-wrap",
|
||||||
"focus:bg-white",
|
"focus:bg-white",
|
||||||
"focus:outline-none",
|
"focus:outline-none",
|
||||||
"focus:ring-4",
|
"focus:ring-4",
|
||||||
@ -258,6 +258,8 @@
|
|||||||
"gap-1",
|
"gap-1",
|
||||||
"gap-2",
|
"gap-2",
|
||||||
"gap-4",
|
"gap-4",
|
||||||
|
"gap-x-1.5",
|
||||||
|
"gap-y-2",
|
||||||
"grid",
|
"grid",
|
||||||
"grid-cols-1",
|
"grid-cols-1",
|
||||||
"group",
|
"group",
|
||||||
@ -266,6 +268,7 @@
|
|||||||
"group-data-[theme=dark]:hidden",
|
"group-data-[theme=dark]:hidden",
|
||||||
"group-data-[theme=light]:hidden",
|
"group-data-[theme=light]:hidden",
|
||||||
"group-hover/code:opacity-100",
|
"group-hover/code:opacity-100",
|
||||||
|
"group-hover:underline",
|
||||||
"group-open:before:rotate-90",
|
"group-open:before:rotate-90",
|
||||||
"group/code",
|
"group/code",
|
||||||
"group/copybtn",
|
"group/copybtn",
|
||||||
@ -407,6 +410,7 @@
|
|||||||
"ml-1",
|
"ml-1",
|
||||||
"ml-4",
|
"ml-4",
|
||||||
"mobile-menu-overlay",
|
"mobile-menu-overlay",
|
||||||
|
"mr-1",
|
||||||
"mr-2",
|
"mr-2",
|
||||||
"mt-1",
|
"mt-1",
|
||||||
"mt-1.5",
|
"mt-1.5",
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
backToTop: "Scroll to top"
|
backToTop: "Scroll to top"
|
||||||
changeLanguage: "Change language"
|
changeLanguage: "Change language"
|
||||||
changeTheme: "Change theme"
|
changeTheme: "Change theme"
|
||||||
|
copyCode: "Copy code"
|
||||||
copyright: "© 2023 Hextra Project."
|
copyright: "© 2023 Hextra Project."
|
||||||
dark: "Dark"
|
dark: "Dark"
|
||||||
editThisPage: "Edit this page on GitHub →"
|
editThisPage: "Edit this page on GitHub →"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
{{- $class := .Attributes.class | default "" -}}
|
{{- $class := .Attributes.class | default "" -}}
|
||||||
{{- $filename := .Attributes.filename | default "" -}}
|
{{- $filename := .Attributes.filename | default "" -}}
|
||||||
{{- $lang := .Attributes.lang | default .Type -}}
|
{{- $lang := .Attributes.lang | default .Type -}}
|
||||||
|
{{- $copyCode := (T "copyCode") | default "Copy code" -}}
|
||||||
|
|
||||||
|
|
||||||
<div class="code-block relative mt-6 first:mt-0 group/code">
|
<div class="code-block relative mt-6 first:mt-0 group/code">
|
||||||
@ -8,17 +9,14 @@
|
|||||||
<div class="filename">{{ $filename }}</div>
|
<div class="filename">{{ $filename }}</div>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- if transform.CanHighlight $lang -}}
|
{{- if transform.CanHighlight $lang -}}
|
||||||
<div id="code-block-{{ .Ordinal }}">
|
<div>{{- highlight .Inner $lang .Options -}}</div>
|
||||||
{{- highlight .Inner $lang .Options -}}
|
|
||||||
</div>
|
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
<pre><code id="code-block-{{ .Ordinal }}">{{ .Inner }}</code></pre>
|
<pre><code>{{ .Inner }}</code></pre>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
<div class="opacity-0 transition group-hover/code:opacity-100 flex gap-1 absolute m-[11px] right-0 {{ if $filename }}top-8{{ else }}top-0{{ end }}">
|
<div class="opacity-0 transition group-hover/code:opacity-100 flex gap-1 absolute m-[11px] right-0 {{ if $filename }}top-8{{ else }}top-0{{ end }}">
|
||||||
<button
|
<button
|
||||||
class="code-copy-btn group/copybtn transition-all active:opacity-50 bg-primary-700/5 border border-black/5 text-gray-600 hover:text-gray-900 rounded-md p-1.5 dark:bg-primary-300/10 dark:border-white/10 dark:text-gray-400 dark:hover:text-gray-50"
|
class="code-copy-btn group/copybtn transition-all active:opacity-50 bg-primary-700/5 border border-black/5 text-gray-600 hover:text-gray-900 rounded-md p-1.5 dark:bg-primary-300/10 dark:border-white/10 dark:text-gray-400 dark:hover:text-gray-50"
|
||||||
title="Copy code"
|
title="{{ $copyCode }}"
|
||||||
data-clipboard-target="#code-block-{{ .Ordinal }}"
|
|
||||||
>
|
>
|
||||||
<div class="group-[.copied]/copybtn:hidden copy-icon pointer-events-none h-4 w-4"></div>
|
<div class="group-[.copied]/copybtn:hidden copy-icon pointer-events-none h-4 w-4"></div>
|
||||||
<div class="hidden group-[.copied]/copybtn:block success-icon pointer-events-none h-4 w-4"></div>
|
<div class="hidden group-[.copied]/copybtn:block success-icon pointer-events-none h-4 w-4"></div>
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
{{- $alt := .PlainText | safeHTML -}}
|
{{- $alt := .PlainText | safeHTML -}}
|
||||||
{{- $lazyLoading := .Page.Site.Params.enableImagelazyLoading | default true -}}
|
{{- $lazyLoading := .Page.Site.Params.enableImageLazyLoading | default true -}}
|
||||||
{{- $dest := .Destination -}}
|
{{- $dest := .Destination -}}
|
||||||
|
|
||||||
{{- $isRemote := not (urls.Parse $dest).Scheme -}}
|
{{- $isLocal := not (urls.Parse $dest).Scheme -}}
|
||||||
{{- $isPage := and (eq .Page.Kind "page") (not .Page.BundleType) -}}
|
{{- $isPage := and (eq .Page.Kind "page") (not .Page.BundleType) -}}
|
||||||
{{- $startsWithSlash := hasPrefix $dest "/" -}}
|
{{- $startsWithSlash := hasPrefix $dest "/" -}}
|
||||||
{{- $startsWithRelative := hasPrefix $dest "../" -}}
|
{{- $startsWithRelative := hasPrefix $dest "../" -}}
|
||||||
|
|
||||||
{{- if and $dest $isRemote -}}
|
{{- if and $dest $isLocal -}}
|
||||||
{{- if $startsWithSlash -}}
|
{{- if $startsWithSlash -}}
|
||||||
{{/* Images under static directory */}}
|
{{/* Images under static directory */}}
|
||||||
{{- $dest = (relURL (strings.TrimPrefix "/" $dest)) -}}
|
{{- $dest = (relURL (strings.TrimPrefix "/" $dest)) -}}
|
||||||
|
@ -1,27 +1,40 @@
|
|||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
<div class='mx-auto flex {{ partial "utils/page-width" . }}'>
|
<div class="mx-auto flex {{ partial `utils/page-width` . }}">
|
||||||
{{ partial "sidebar.html" (dict "context" . "disableSidebar" true "displayPlaceholder" true) }}
|
{{ partial "sidebar.html" (dict "context" . "disableSidebar" true "displayPlaceholder" true) }}
|
||||||
{{ partial "toc.html" . }}
|
{{ partial "toc.html" . }}
|
||||||
<article class="w-full break-words flex min-h-[calc(100vh-var(--navbar-height))] min-w-0 justify-center pb-8 pr-[calc(env(safe-area-inset-right)-1.5rem)]">
|
<article class="w-full break-words flex min-h-[calc(100vh-var(--navbar-height))] min-w-0 justify-center pb-8 pr-[calc(env(safe-area-inset-right)-1.5rem)]">
|
||||||
<main class="w-full min-w-0 max-w-6xl px-6 pt-4 md:px-12">
|
<main class="w-full min-w-0 max-w-6xl px-6 pt-4 md:px-12">
|
||||||
{{ partial "breadcrumb.html" . }}
|
{{ partial "breadcrumb.html" . }}
|
||||||
<h1 class="mt-2 text-4xl font-bold tracking-tight text-slate-900 dark:text-slate-100">{{ .Title }}</h1>
|
<h1 class="mt-2 text-4xl font-bold tracking-tight text-slate-900 dark:text-slate-100">{{ .Title }}</h1>
|
||||||
{{ with $date := .Date }}
|
<div class="mt-4 mb-16 text-gray-500 text-sm flex items-center flex-wrap gap-y-2">
|
||||||
<div class="mt-4 mb-16 text-gray-500 text-sm">
|
{{- with $date := .Date }}<span class="mr-1">{{ partial "utils/format-date" $date }}</span>{{ end -}}
|
||||||
{{ partial "utils/format-date" $date }}
|
{{- $lazyLoading := site.Params.enableImageLazyLoading | default true -}}
|
||||||
{{- if $.Params.authors }} by {{ end -}}
|
{{ if and .Date .Params.authors }}<span class="mx-1">·</span>{{ end -}}
|
||||||
{{- with $.Params.authors -}}
|
{{- with $.Params.authors -}}
|
||||||
{{- range $i, $author := . -}}
|
{{- range $i, $author := . -}}
|
||||||
{{- if $i }},{{ end -}}
|
{{- if reflect.IsMap $author -}}
|
||||||
{{- if $author.link -}}
|
{{- if and $i (not $author.image) }}<span class="mr-1">,</span>{{ end -}}
|
||||||
<a href="{{ $author.link }}" target="_blank" class="mx-1 text-current underline [text-underline-position:from-font] decoration-from-font">{{ $author.name }}</a>
|
<a
|
||||||
{{- else -}}
|
{{ with $author.link }}href="{{ . }}" target="_blank"{{ end }}
|
||||||
<span>{{ $author.name }}</span>
|
class="group inline-flex items-center text-current gap-x-1.5 mx-1"
|
||||||
{{- end -}}
|
{{ with $author.name }}title="{{ . }}"{{ end }}
|
||||||
|
>
|
||||||
|
{{- with $image := $author.image }}
|
||||||
|
{{- $isLocal := not (urls.Parse $image).Scheme -}}
|
||||||
|
{{- $startsWithSlash := hasPrefix $image "/" -}}
|
||||||
|
{{- if and $isLocal $startsWithSlash }}
|
||||||
|
{{- $image = (relURL (strings.TrimPrefix "/" $image)) -}}
|
||||||
|
{{ end -}}
|
||||||
|
<img src="{{ $image | safeURL }}" alt="{{ $author.name }}" class="inline-block h-4 w-4 rounded-full" {{ if $lazyLoading }}loading="lazy"{{ end }} />
|
||||||
|
{{ end -}}
|
||||||
|
<div class="group-hover:underline">{{ $author.name }}</div>
|
||||||
|
</a>
|
||||||
|
{{- else -}}
|
||||||
|
{{- if $i }}<span class="mr-1">,</span>{{ end -}}<span class="mx-1">{{ $author }}</span>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
</div>
|
{{- end -}}
|
||||||
{{ end }}
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
{{ .Content }}
|
{{ .Content }}
|
||||||
</div>
|
</div>
|
||||||
|
@ -36,9 +36,11 @@
|
|||||||
|
|
||||||
{{- define "theme-credit" -}}
|
{{- define "theme-credit" -}}
|
||||||
<a class="flex text-sm items-center gap-1 text-current" target="_blank" rel="noopener noreferrer" title="Hextra GitHub Homepage" href="https://github.com/imfing/hextra">
|
<a class="flex text-sm items-center gap-1 text-current" target="_blank" rel="noopener noreferrer" title="Hextra GitHub Homepage" href="https://github.com/imfing/hextra">
|
||||||
<span
|
<span>
|
||||||
>{{ . | safeHTML }}
|
{{- . | markdownify -}}
|
||||||
{{- partial "utils/icon.html" (dict "name" "hextra" "attributes" "height=1em class=\"inline-block ml-1 align-text-bottom\"") -}}
|
{{- if strings.Contains . "Hextra" -}}
|
||||||
|
{{- partial "utils/icon.html" (dict "name" "hextra" "attributes" `height=1em class="inline-block ml-1 align-text-bottom"`) -}}
|
||||||
|
{{- end -}}
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
@ -32,10 +32,17 @@
|
|||||||
{{- if eq .Params.type "search" -}}
|
{{- if eq .Params.type "search" -}}
|
||||||
{{- partial "search.html" (dict "params" .Params) -}}
|
{{- partial "search.html" (dict "params" .Params) -}}
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
{{- $external := strings.HasPrefix .URL "http" -}}
|
{{- $link := .URL -}}
|
||||||
|
{{- $external := strings.HasPrefix $link "http" -}}
|
||||||
|
{{- with .PageRef -}}
|
||||||
|
{{- if hasPrefix . "/" -}}
|
||||||
|
{{- $link = relLangURL (strings.TrimPrefix "/" .) -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
{{/* Display icon menu item */}}
|
{{/* Display icon menu item */}}
|
||||||
{{- if .Params.icon -}}
|
{{- if .Params.icon -}}
|
||||||
<a class="p-2 text-current" {{ if $external }}target="_blank" rel="noreferer"{{ end }} href="{{ .URL | relLangURL }}" title="{{ or (T .Identifier) .Name | safeHTML }}">
|
<a class="p-2 text-current" {{ if $external }}target="_blank" rel="noreferer"{{ end }} href="{{ $link }}" title="{{ or (T .Identifier) .Name | safeHTML }}">
|
||||||
{{- partial "utils/icon.html" (dict "name" .Params.icon "attributes" "height=24") -}}
|
{{- partial "utils/icon.html" (dict "name" .Params.icon "attributes" "height=24") -}}
|
||||||
<span class="sr-only">{{ or (T .Identifier) .Name | safeHTML }}</span>
|
<span class="sr-only">{{ or (T .Identifier) .Name | safeHTML }}</span>
|
||||||
</a>
|
</a>
|
||||||
@ -44,7 +51,7 @@
|
|||||||
{{- $activeClass := cond $active "font-medium" "text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200" -}}
|
{{- $activeClass := cond $active "font-medium" "text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200" -}}
|
||||||
<a
|
<a
|
||||||
title="{{ or (T .Identifier) .Name | safeHTML }}"
|
title="{{ or (T .Identifier) .Name | safeHTML }}"
|
||||||
href="{{ .URL | relLangURL }}"
|
href="{{ $link }}"
|
||||||
{{ if $external }}target="_blank" rel="noreferer"{{ end }}
|
{{ if $external }}target="_blank" rel="noreferer"{{ end }}
|
||||||
class="text-sm contrast-more:text-gray-700 contrast-more:dark:text-gray-100 relative -ml-2 hidden whitespace-nowrap p-2 md:inline-block {{ $activeClass }}"
|
class="text-sm contrast-more:text-gray-700 contrast-more:dark:text-gray-100 relative -ml-2 hidden whitespace-nowrap p-2 md:inline-block {{ $activeClass }}"
|
||||||
>
|
>
|
||||||
|
@ -6,9 +6,14 @@
|
|||||||
{{- $sidebarClass := cond $disableSidebar (cond $displayPlaceholder "md:hidden xl:block" "md:hidden") "md:sticky" -}}
|
{{- $sidebarClass := cond $disableSidebar (cond $displayPlaceholder "md:hidden xl:block" "md:hidden") "md:sticky" -}}
|
||||||
|
|
||||||
{{- $navRoot := cond (eq site.Home.Type "docs") site.Home $context.FirstSection -}}
|
{{- $navRoot := cond (eq site.Home.Type "docs") site.Home $context.FirstSection -}}
|
||||||
{{- $navPages := union $navRoot.RegularPages $navRoot.Sections -}}
|
|
||||||
{{- $pageURL := $context.RelPermalink -}}
|
{{- $pageURL := $context.RelPermalink -}}
|
||||||
|
|
||||||
|
{{/* EXPERIMENTAL */}}
|
||||||
|
{{- if .context.Params.sidebar.hide -}}
|
||||||
|
{{- $disableSidebar = true -}}
|
||||||
|
{{- $displayPlaceholder = true -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
|
||||||
<div class="mobile-menu-overlay [transition:background-color_1.5s_ease] fixed inset-0 z-10 bg-black/80 dark:bg-black/60 hidden"></div>
|
<div class="mobile-menu-overlay [transition:background-color_1.5s_ease] fixed inset-0 z-10 bg-black/80 dark:bg-black/60 hidden"></div>
|
||||||
<aside class="sidebar-container flex flex-col print:hidden md:top-16 md:shrink-0 md:w-64 md:self-start max-md:[transform:translate3d(0,-100%,0)] {{ $sidebarClass }}">
|
<aside class="sidebar-container flex flex-col print:hidden md:top-16 md:shrink-0 md:w-64 md:self-start max-md:[transform:translate3d(0,-100%,0)] {{ $sidebarClass }}">
|
||||||
@ -68,17 +73,24 @@
|
|||||||
{{- $toc := .toc | default false -}}
|
{{- $toc := .toc | default false -}}
|
||||||
|
|
||||||
{{- with $items := union .context.RegularPages .context.Sections -}}
|
{{- with $items := union .context.RegularPages .context.Sections -}}
|
||||||
|
{{- $items = where $items "Params.sidebar.exclude" "!=" true -}}
|
||||||
{{- if eq $level 0 -}}
|
{{- if eq $level 0 -}}
|
||||||
{{- range $items.ByWeight }}
|
{{- range $items.ByWeight }}
|
||||||
{{- $active := eq $pageURL .RelPermalink -}}
|
{{- if .Params.sidebar.separator -}}
|
||||||
{{- $shouldOpen := or (.Params.sidebar.open) (.IsAncestor $page) $active | default true }}
|
<li class="[word-break:break-word] mt-5 mb-2 px-2 py-1.5 text-sm font-semibold text-gray-900 first:mt-0 dark:text-gray-100">
|
||||||
<li class="{{ if $shouldOpen }}open{{ end }}">
|
<span class="cursor-default">{{ .LinkTitle }}</span>
|
||||||
{{- template "sidebar-item-link" dict "context" . "active" $active "title" .LinkTitle "link" .RelPermalink -}}
|
</li>
|
||||||
{{- if and $toc $active -}}
|
{{- else -}}
|
||||||
{{- template "sidebar-toc" dict "page" . -}}
|
{{- $active := eq $pageURL .RelPermalink -}}
|
||||||
{{- end -}}
|
{{- $shouldOpen := or (.Params.sidebar.open) (.IsAncestor $page) $active | default true }}
|
||||||
{{- template "sidebar-tree" dict "context" . "page" $page "pageURL" $pageURL "level" (add $level 1) "toc" $toc -}}
|
<li class="{{ if $shouldOpen }}open{{ end }}">
|
||||||
</li>
|
{{- template "sidebar-item-link" dict "context" . "active" $active "title" .LinkTitle "link" .RelPermalink -}}
|
||||||
|
{{- if and $toc $active -}}
|
||||||
|
{{- template "sidebar-toc" dict "page" . -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- template "sidebar-tree" dict "context" . "page" $page "pageURL" $pageURL "level" (add $level 1) "toc" $toc -}}
|
||||||
|
</li>
|
||||||
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
<div class="ltr:pr-0 overflow-hidden">
|
<div class="ltr:pr-0 overflow-hidden">
|
||||||
@ -111,7 +123,7 @@
|
|||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
href="#{{ anchorize .ID }}"
|
href="#{{ anchorize .ID }}"
|
||||||
class="flex rounded px-2 py-1.5 text-sm transition-colors [word-break:break-word] cursor-pointer [-webkit-tap-highlight-color:transparent] [-webkit-touch-callout:none] contrast-more:border flex gap-2 before:opacity-25 before:content-['#'] text-gray-500 hover:bg-gray-100 hover:text-gray-900 dark:text-neutral-400 dark:hover:bg-primary-100/5 dark:hover:text-gray-50 contrast-more:text-gray-900 contrast-more:dark:text-gray-50 contrast-more:border-transparent contrast-more:hover:border-gray-900 contrast-more:dark:hover:border-gray-50"
|
class="flex rounded px-2 py-1.5 text-sm transition-colors [word-break:break-word] cursor-pointer [-webkit-tap-highlight-color:transparent] [-webkit-touch-callout:none] contrast-more:border gap-2 before:opacity-25 before:content-['#'] text-gray-500 hover:bg-gray-100 hover:text-gray-900 dark:text-neutral-400 dark:hover:bg-primary-100/5 dark:hover:text-gray-50 contrast-more:text-gray-900 contrast-more:dark:text-gray-50 contrast-more:border-transparent contrast-more:hover:border-gray-900 contrast-more:dark:hover:border-gray-50"
|
||||||
>
|
>
|
||||||
{{- .Title -}}
|
{{- .Title -}}
|
||||||
</a>
|
</a>
|
||||||
@ -153,17 +165,13 @@
|
|||||||
{{- with .context }}
|
{{- with .context }}
|
||||||
{{- if or .RegularPages .Sections }}
|
{{- if or .RegularPages .Sections }}
|
||||||
<span class="hextra-sidebar-collapsible-button">
|
<span class="hextra-sidebar-collapsible-button">
|
||||||
{{- template "sidebear-collapsible-button" -}}
|
{{- template "sidebar-collapsible-button" -}}
|
||||||
</span>
|
</span>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
</a>
|
</a>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- define "sidebar-separator" -}}
|
{{- define "sidebar-collapsible-button" -}}
|
||||||
<div class="mt-4 border-t py-4 dark:border-neutral-800 contrast-more:border-neutral-400 dark:contrast-more:border-neutral-400" />
|
|
||||||
{{- end -}}
|
|
||||||
|
|
||||||
{{- define "sidebear-collapsible-button" -}}
|
|
||||||
<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" class="h-[18px] min-w-[18px] rounded-sm p-0.5 hover:bg-gray-800/5 dark:hover:bg-gray-100/5"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" class="origin-center transition-transform rtl:-rotate-180"></path></svg>
|
<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" class="h-[18px] min-w-[18px] rounded-sm p-0.5 hover:bg-gray-800/5 dark:hover:bg-gray-100/5"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" class="origin-center transition-transform rtl:-rotate-180"></path></svg>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
{{- if site.Params.editURL.enable -}}
|
{{- if site.Params.editURL.enable -}}
|
||||||
{{- $editURL := site.Params.editURL.base | default "" -}}
|
{{- $editURL := site.Params.editURL.base | default "" -}}
|
||||||
{{- with .File -}}{{ $editURL = urls.JoinPath $editURL (replace .Path "\\" "/") }}{{- end -}}
|
{{- with .File -}}{{ $editURL = urls.JoinPath $editURL (replace .Path "\\" "/") }}{{- end -}}
|
||||||
{{- with .Params.editURL -}}{{ $editURL = .Params.editURL }}{{- end -}}
|
{{- with .Params.editURL -}}{{ $editURL = . }}{{- end -}}
|
||||||
<a class="text-xs font-medium text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-100 contrast-more:text-gray-800 contrast-more:dark:text-gray-50" href="{{ $editURL }}" target="_blank" rel="noreferer">{{ $editThisPage }}</a>
|
<a class="text-xs font-medium text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-100 contrast-more:text-gray-800 contrast-more:dark:text-gray-50" href="{{ $editURL }}" target="_blank" rel="noreferer">{{ $editThisPage }}</a>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{/* Scroll To Top */}}
|
{{/* Scroll To Top */}}
|
||||||
@ -59,7 +59,7 @@
|
|||||||
{{- if .Title }}
|
{{- if .Title }}
|
||||||
<li class="my-2 scroll-my-6 scroll-py-6">
|
<li class="my-2 scroll-my-6 scroll-py-6">
|
||||||
<a class="{{ $class }} inline-block text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300 contrast-more:text-gray-900 contrast-more:underline contrast-more:dark:text-gray-50 w-full break-words" href="#{{ anchorize .ID }}">
|
<a class="{{ $class }} inline-block text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300 contrast-more:text-gray-900 contrast-more:underline contrast-more:dark:text-gray-50 w-full break-words" href="#{{ anchorize .ID }}">
|
||||||
{{- .Title | safeHTML | plainify }}
|
{{- .Title | safeHTML | plainify | htmlUnescape }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
@ -35,12 +35,12 @@
|
|||||||
{{ $headingTitle := index $headingTitles $i }}
|
{{ $headingTitle := index $headingTitles $i }}
|
||||||
|
|
||||||
{{ if eq $i 0 }}
|
{{ if eq $i 0 }}
|
||||||
{{ $data = $data | merge (dict $headingKey ($content | markdownify | plainify | htmlUnescape | chomp)) }}
|
{{ $data = $data | merge (dict $headingKey ($content | $page.RenderString | plainify | htmlUnescape | chomp)) }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
{{ $parts := split $content (printf "\n%s\n" $headingTitle) }}
|
{{ $parts := split $content (printf "\n%s\n" $headingTitle) }}
|
||||||
{{ $lastPart := index $parts (sub (len $parts) 1) }}
|
{{ $lastPart := index $parts (sub (len $parts) 1) }}
|
||||||
|
|
||||||
{{ $data = $data | merge (dict $headingKey ($lastPart | markdownify | plainify | htmlUnescape | chomp)) }}
|
{{ $data = $data | merge (dict $headingKey ($lastPart | $page.RenderString | plainify | htmlUnescape | chomp)) }}
|
||||||
{{ $content = strings.TrimSuffix $lastPart $content }}
|
{{ $content = strings.TrimSuffix $lastPart $content }}
|
||||||
{{ $content = strings.TrimSuffix (printf "\n%s\n" $headingTitle) $content }}
|
{{ $content = strings.TrimSuffix (printf "\n%s\n" $headingTitle) $content }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@ -79,3 +79,4 @@
|
|||||||
<div class="line-clamp-3 text-sm font-normal text-gray-500 dark:text-gray-400 px-4 mb-4 mt-2">{{- $subtitle | markdownify -}}</div>
|
<div class="line-clamp-3 text-sm font-normal text-gray-500 dark:text-gray-400 px-4 mb-4 mt-2">{{- $subtitle | markdownify -}}</div>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
</a>
|
</a>
|
||||||
|
{{- /* Strip trailing newline. */ -}}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{{ $rows := .Get "rows" | default "3" }}
|
{{ $rows := .Get "rows" | default "3" }}
|
||||||
|
|
||||||
<div class="hextra-cards mt-4 gap-4 grid not-prose" style="--rows: {{ $rows }};">
|
<div class="hextra-cards mt-4 gap-4 grid not-prose" style="--rows: {{ $rows }};">
|
||||||
{{ .Inner }}
|
{{- .Inner -}}
|
||||||
</div>
|
</div>
|
||||||
|
@ -10,6 +10,10 @@
|
|||||||
{{- $external := hasPrefix $link "http" -}}
|
{{- $external := hasPrefix $link "http" -}}
|
||||||
{{- $href := cond (strings.HasPrefix $link "/") ($link | relURL) $link -}}
|
{{- $href := cond (strings.HasPrefix $link "/") ($link | relURL) $link -}}
|
||||||
|
|
||||||
|
{{- if hasPrefix $image "/" -}}
|
||||||
|
{{- $image = relURL (strings.TrimPrefix "/" $image) -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
<a
|
<a
|
||||||
{{ with $link }}href="{{ $href }}" {{ with $external }} target="_blank" rel="noreferrer"{{ end }}{{ end }}
|
{{ with $link }}href="{{ $href }}" {{ with $external }} target="_blank" rel="noreferrer"{{ end }}{{ end }}
|
||||||
{{ with $style }}style="{{ . | safeCSS }}"{{ end }}
|
{{ with $style }}style="{{ . | safeCSS }}"{{ end }}
|
||||||
|
22
layouts/shortcodes/include.html
Normal file
22
layouts/shortcodes/include.html
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{{- /*
|
||||||
|
https://github.com/gohugoio/gohugoioTheme/blob/master/layouts/shortcodes/include.html
|
||||||
|
|
||||||
|
Renders the page using the RenderShortcode method on the Page object.
|
||||||
|
|
||||||
|
You must call this shortcode using the {{% %}} notation.
|
||||||
|
|
||||||
|
@param {string} (postional parameter 0) The path to the page, relative to the content directory.
|
||||||
|
@returns template.HTML
|
||||||
|
|
||||||
|
@example {{% include "functions/_common/glob-patterns" %}}
|
||||||
|
*/}}
|
||||||
|
|
||||||
|
{{- with .Get 0 }}
|
||||||
|
{{- with site.GetPage . }}
|
||||||
|
{{- .RenderShortcodes }}
|
||||||
|
{{- else }}
|
||||||
|
{{- errorf "The %q shortcode was unable to find %q. See %s" $.Name . $.Position }}
|
||||||
|
{{- end }}
|
||||||
|
{{- else }}
|
||||||
|
{{- errorf "The %q shortcode requires a positional parameter indicating the path of the file to include. See %s" .Name .Position }}
|
||||||
|
{{- end }}
|
Reference in New Issue
Block a user