Compare commits

...

20 Commits

Author SHA1 Message Date
00d26dee2c fix: swap navbar logo width and height (#58)
Height/Width swap issue.
2023-09-14 08:17:28 +01:00
Xin
e9ea9786e9 feat: enhance scrollbar style (#56)
* feat: enhance scrollbar style

* chore: set `color-scheme` for document element
2023-09-14 00:01:38 +01:00
84ac7fe773 docs: add example for customizing css for inline code element (#55)
* discussion #40

* discussion #46

* corrected Go code

* removed code block section

* changed heading to 'Inline Code Element'

---------

Co-authored-by: Saurabh Mishra <saurabh.m@mailfence.com>
2023-09-13 22:34:46 +01:00
Xin
a184cfd41e fix: use relURL only for link starts with slash (#54) 2023-09-13 05:40:00 -04:00
Xin
76ac694542 feat: add backdrop blur for nav bar (#53) 2023-09-13 10:02:38 +01:00
Xin
f70ba59ca0 fix: use relative url for card link (#52)
* fix: cards links should not redirect to 404

* docs: update card links

* fix: use relURL for card link
2023-09-13 09:49:01 +01:00
Xin
4a9a2850fc docs: add instruction for using markdown in tabs (#47) 2023-09-13 07:54:44 +01:00
Xin
4553a8eda2 docs: add more instruction for favicon (#44) 2023-09-11 17:15:24 -04:00
Xin
237d890f67 ci: use dynamic repo and username for baseURL 2023-09-10 15:20:17 +01:00
Xin
04e131f93a chore: normalize headings (#42)
* chore: minor update to card component

* chore: normalize headings of blog and single page
2023-09-10 14:54:30 +01:00
Xin
61e41f247b chore: add contributing guide
[skip ci]
2023-09-10 12:07:04 +01:00
6d00cb32b0 docs: add Logo, Favicon in Configurations (#37)
* Add Configuration for Logo, Favicon.

---------

Co-authored-by: Xin <xin@imfing.com>
2023-09-05 23:45:05 +01:00
939acc02a8 fix: add line break for steps shortcode example usage
* there needs to be a line break between {{% steps %}} and the first H3

If there is no line break between {{% steps %}}  and the first heading, the content is not rendered correctly.

* Update exampleSite/content/docs/guide/shortcodes/steps.md

* Update exampleSite/content/docs/guide/shortcodes/steps.md
2023-09-05 06:24:51 -04:00
Sid
e4c36236df ci: setup actions/checkout@v3 to fetch complete Git history (#32)
Attempt to fix #31
2023-09-03 19:05:33 +01:00
Xin
4381f31085 chore: make index page container wider (#30)
* chore: enable footer by default

* chore: make index container wider
2023-09-03 16:12:53 +01:00
Xin
171399889d docs: add instruction to update theme 2023-09-02 16:02:28 +01:00
Xin
3bcdf84ad4 feat: details shortcode (#28)
* feat: details shortcode

* docs: add details shortcode page

* chore: update shortcodes page

* docs: update

* Revert "chore: update shortcodes page"

This reverts commit c005ad4cb1.
2023-09-02 16:01:34 +01:00
Xin
8e8f7f23c9 chore: increase home heading text line height 2023-09-02 00:10:51 +00:00
Xin
5b71912ab2 feat: support markdown for copyright text (#25)
* feat: support markdown for copyright text

* docs: add info about supporting markdown in copyright
2023-09-01 22:38:49 +01:00
34c6f6c7f3 docs: added info to configure footer (#23) 2023-09-01 22:19:14 +01:00
32 changed files with 1644 additions and 1961 deletions

110
.github/CONTRIBUTING.md vendored Normal file
View File

@ -0,0 +1,110 @@
# Contribute to Hextra
👋 Thank you for being interested in contributing to Hextra! As an open source project, we welcome contributions of many forms including bug reports, feature requests, documentation improvements, and code contributions.
<!-- omit in toc -->
## Table of Contents
- [Guidelines](#guidelines)
- [Contributing Code](#contributing-code)
- [Contributing Documentation](#contributing-documentation)
- [💬 GitHub Discussions](#-github-discussions)
- [GitHub Issues](#github-issues)
- [Development](#development)
- [Local development setup](#local-development-setup)
- [Project structure](#project-structure)
- [Start the development server](#start-the-development-server)
- [Compile the styles](#compile-the-styles)
## Guidelines
### Contributing Code
To contribute, please follow the ["Fork and Pull Request"][fork and pull] workflow
Fork the repository, make your changes, and then submit a pull request.
Please make sure to include a description of the changes you made and why you made them.
Use [Conventional Commits][conventional commits] message to make it easier to understand the changes you made.
### Contributing Documentation
Similar to contributing code, you can also contribute to the documentation by submitting a pull request.
The documentation site is located in the [`exampleSite`](../exampleSite/) folder.
You can make changes to the documentation and create a pull request. A preview of the new documentation will be automatically generated and displayed in the pull request comment via [Netlify][netlify deploy preview].
### 💬 GitHub Discussions
Were using [Discussions][discussions] as a place to connect with other members using Hextra:
- Ask questions youre wondering about.
- Share ideas.
- Engage with other users.
### GitHub Issues
If you find a bug or have a feature request, please [open an issue][issues].
Please make sure to include a description of the bug or feature you are requesting. If you are reporting a bug, please include steps to reproduce the bug.
We recommend that you search existing [issues][issues] or discussions before opening a new one to prevent duplicates.
## Development
> **Note**
> You can start developing on [GitHub Codespaces][open in codespaces] or use [devcontainer][devcontainer] locally without installing any dependencies.
### Local development setup
- [Hugo][hugo] >= v0.115.0 (extended version)
- [Node.js][nodejs]
- [Go][go]
Install dependencies:
```bash
npm i
```
### Project structure
- [`assets`](../assets/): CSS styles and JavaScript files.
- [`data`](../data/): The theme data files. Now only contains the `icons.yaml` file.
- [`exampleSite`](../exampleSite/): The documentation site for the theme.
- [`i18n`](../i18n/): The theme translation files.
- [`layouts`](../layouts/): The theme layouts.
- [`static`](../static/): The static files for the theme. For example, the favicon and the site logo.
Please refer to the [Hugo documentation][hugo] for more information.
### Start the development server
```bash
npm run dev:theme
```
It will start the Hugo server on `http://localhost:1313/` for the `exampleSite` content.
### Compile the styles
For development preview, we compile the Tailwind CSS styles on the fly. But for production, we need to compile the styles first.
```bash
npm run build:css
```
It will compile the Tailwind CSS styles and generate the `assets/css/compiled/main.css` file.
<!--links-->
[fork and pull]: https://docs.github.com/en/get-started/quickstart/contributing-to-projects
[conventional commits]: https://www.conventionalcommits.org
[issues]: https://github.com/imfing/hextra/issues
[discussions]: https://github.com/imfing/hextra/discussions
[nodejs]: https://nodejs.org/en/
[hugo]: https://gohugo.io/
[go]: https://golang.org/doc/install
[devcontainer]: https://code.visualstudio.com/docs/devcontainers/containers
[open in codespaces]: https://codespaces.new/imfing/hextra
[netlify deploy preview]: https://docs.netlify.com/site-deploys/deploy-previews/

View File

@ -35,6 +35,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- name: Setup Go
uses: actions/setup-go@v4
with:
@ -53,7 +55,7 @@ jobs:
hugo \
--minify \
--themesDir=../.. --source=exampleSite \
--baseURL "https://imfing.github.io/hextra/"
--baseURL "https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/"
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:

View File

@ -1,4 +1,5 @@
{
"editor.tabSize": 2,
"css.customData": [".vscode/tailwind.json"]
"css.customData": [".vscode/tailwind.json"],
"markdown.extension.toc.levels": "2..6"
}

View File

@ -31,13 +31,16 @@ Using the [Hextra Starter Template](https://github.com/imfing/hextra-starter-tem
The template repository also includes a [GitHub Actions workflow](https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#publishing-with-a-custom-github-actions-workflow) for deploying your website to GitHub Pages.
<img alt="Hextra Starter Template" src="https://user-images.githubusercontent.com/5097752/263551418-c403b9a9-a76c-47a6-8466-513d772ef0b7.jpg" width=600/>
### Usage
Refer to the [documentation](https://imfing.github.io/hextra/docs) for more information.
## Contributing
This project is actively under development. Contributions are welcome!
Contributions are welcome!
Check out the [contributing guide](.github/CONTRIBUTING.md) to get started.
## License

File diff suppressed because it is too large Load Diff

View File

@ -4,6 +4,14 @@ nav {
}
}
@supports (
(-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))
) {
.nav-container-blur {
@apply backdrop-blur-md bg-white/[.85] dark:!bg-dark/80;
}
}
.hamburger-menu svg {
g {
@apply origin-center;

View File

@ -0,0 +1,21 @@
.hextra-scrollbar {
scrollbar-width: thin; /* Firefox */
scrollbar-color: oklch(55.55% 0 0 / 40%) transparent; /* Firefox */
scrollbar-gutter: stable;
&::-webkit-scrollbar {
@apply w-3 h-3;
}
&::-webkit-scrollbar-track {
@apply bg-transparent;
}
&::-webkit-scrollbar-thumb {
@apply rounded-[10px];
}
&:hover::-webkit-scrollbar-thumb {
border: 3px solid transparent;
background-color: var(--tw-shadow-color);
background-clip: content-box;
@apply shadow-neutral-500/20 hover:shadow-neutral-500/40;
}
}

View File

@ -1,3 +1,5 @@
@import "tailwind.css";
@import "typography.css";
@import "highlight.css";
@import "components/cards.css";
@ -5,10 +7,7 @@
@import "components/search.css";
@import "components/sidebar.css";
@import "components/navbar.css";
@tailwind base;
@tailwind components;
@tailwind utilities;
@import "components/scrollbar.css";
html {
@apply text-base antialiased;

3
assets/css/tailwind.css Normal file
View File

@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

View File

@ -17,17 +17,21 @@ themeToggleButtons.forEach((el) => {
if (localStorage.getItem("color-theme")) {
if (localStorage.getItem("color-theme") === "light") {
document.documentElement.classList.add("dark");
document.documentElement.style.colorScheme = "dark";
localStorage.setItem("color-theme", "dark");
} else {
document.documentElement.classList.remove("dark");
document.documentElement.style.colorScheme = "light";
localStorage.setItem("color-theme", "light");
}
} else {
if (document.documentElement.classList.contains("dark")) {
document.documentElement.classList.remove("dark");
document.documentElement.style.colorScheme = "light";
localStorage.setItem("color-theme", "light");
} else {
document.documentElement.classList.add("dark");
document.documentElement.style.colorScheme = "dark";
localStorage.setItem("color-theme", "dark");
}
}

View File

@ -10,7 +10,11 @@ This page describes the available options and how to customize the theme further
## Custom CSS
To add custom CSS, we need to create a file `assets/css/custom.css` in our site. Hextra will automatically load this file. For example, customize the font family of the content:
To add custom CSS, we need to create a file `assets/css/custom.css` in our site. Hextra will automatically load this file.
### Font Family
The font family of the content can be customized using:
```css {filename="assets/css/custom.css"}
.content {
@ -18,6 +22,16 @@ To add custom CSS, we need to create a file `assets/css/custom.css` in our site.
}
```
### Inline Code Element
The color of text mixed with `other text` can customized with:
```css {filename="assets/css/custom.css"}
.content code:not(.code-block code) {
color: #c97c2e;
}
```
### Primary Color
The primary color of the theme can be customized by setting the `--primary-hue` variable:

View File

@ -73,6 +73,21 @@ Voila! You can see your new site at `http://localhost:1313/`.
{{% /steps %}}
## Update Theme
{{% details title="How to update theme?" %}}
To update the theme to the [latest released version](https://github.com/imfing/hextra/releases), run the following command:
```shell
$ hugo mod get -u
```
See [Hugo Modules](https://gohugo.io/hugo-modules/use-modules/#update-all-modules) for more details.
{{% /details %}}
## Next
Explore the following sections to start adding more contents:

View File

@ -65,6 +65,24 @@ There are different types of menu items:
These menu items can be sorted by setting the `weight` parameter.
### Logo and Title
To modify the default logo, edit `hugo.yaml` and add the path to your logo file under `static` directory.
Optionally, you can change the link that users are redirected to when clicking on your logo, as well as set the width & height of the logo in pixels.
```yaml {filename="hugo.yaml"}
params:
navbar:
displayTitle: true
displayLogo: true
logo:
path: images/logo.svg
dark: images/logo-dark.svg
link: /
width: 40
height: 20
```
## Sidebar
### Main Sidebar
@ -124,3 +142,41 @@ params:
editURL: "https://example.com/edit/this/page"
---
```
## Footer
### Copyright
To modify the copyright text displayed in your website's footer, you'll need to create a file named `i18n/en.yaml`.
In this file, specify your new copyright text as shown below:
```yaml {filename="i18n/en.yaml"}
copyright: "© 2023 YOUR TEXT HERE"
```
For your reference, an example [`i18n/en.yaml`](https://github.com/imfing/hextra/blob/main/i18n/en.yaml) file can be found in the GitHub repository. Additionally, you could use Markdown format in the copyright text.
## Others
### Favicon
To customize the [favicon](https://en.wikipedia.org/wiki/Favicon) for your site, place icon files under the `static` folder to override the [default favicons from the theme](https://github.com/imfing/hextra/tree/main/static):
{{< filetree/container >}}
{{< filetree/folder name="static" >}}
{{< filetree/file name="android-chrome-192x192.png" >}}
{{< filetree/file name="android-chrome-512x512.png" >}}
{{< filetree/file name="apple-touch-icon.png" >}}
{{< filetree/file name="favicon-16x16.png" >}}
{{< filetree/file name="favicon-32x32.png" >}}
{{< filetree/file name="favicon-dark.svg" >}}
{{< filetree/file name="favicon.ico" >}}
{{< filetree/file name="favicon.svg" >}}
{{< filetree/file name="site.webmanifest" >}}
{{< /filetree/folder >}}
{{< /filetree/container >}}
Include both `favicon.ico` and `favicon.svg` files in your project to ensure your site's favicons display correctly.
While `favicon.ico` is generally for older browsers, `favicon.svg` is supported by modern ones. The optional `favicon-dark.svg` can be included for a tailored experience in dark mode.
Feel free to use tools like [favicon.io](https://favicon.io/) or [favycon](https://github.com/ruisaraiva19/favycon) to generate these icons.

View File

@ -13,6 +13,7 @@ Hextra provides a collection of beautiful shortcodes to enhance your content.
{{< cards >}}
{{< card link="callout" title="Callout" icon="warning" >}}
{{< card link="cards" title="Cards" icon="card" >}}
{{< card link="details" title="Details" icon="chevron-right" >}}
{{< card link="filetree" title="FileTree" icon="folder-tree" >}}
{{< card link="icon" title="Icon" icon="badge-check" >}}
{{< card link="steps" title="Steps" icon="one" >}}

View File

@ -6,7 +6,7 @@ linkTitle: Cards
## Example
{{< cards >}}
{{< card link="/" title="Callout" icon="warning" >}}
{{< card link="../callout" title="Callout" icon="warning" >}}
{{< card link="/" title="No Icon" >}}
{{< /cards >}}
@ -19,7 +19,7 @@ linkTitle: Cards
```
{{</* cards */>}}
{{</* card link="/" title="Callout" icon="warning" */>}}
{{</* card link="../callout" title="Callout" icon="warning" */>}}
{{</* card link="/" title="No Icon" */>}}
{{</* /cards */>}}
```

View File

@ -0,0 +1,43 @@
---
title: Details
---
A built-in component to display a collapsible content.
<!--more-->
## Example
{{% details title="Details" %}}
This is the content of the details.
Markdown is **supported**.
{{% /details %}}
{{% details title="Click me to reveal" closed="true" %}}
This will be hidden by default.
{{% /details %}}
## Usage
````
{{%/* details title="Details" */%}}
This is the content of the details.
Markdown is **supported**.
{{%/* /details */%}}
````
````
{{%/* details title="Click me to reveal" closed="true" */%}}
This will be hidden by default.
{{%/* /details */%}}
````

View File

@ -29,6 +29,7 @@ Put Markdown h3 header within `steps` shortcode.
```
{{%/* steps */%}}
### Step 1
This is the first step.
@ -36,5 +37,6 @@ This is the first step.
### Step 2
This is the second step.
{{%/* /steps */%}}
```

View File

@ -50,3 +50,44 @@ The `YAML` tab will be selected by default.
{{< tab >}}**TOML**: TOML aims to be a minimal configuration file format that's easy to read due to obvious semantics.{{< /tab >}}
{{< /tabs >}}
### Use Markdown
Markdown syntax including code block is also supported:
````
{{</* tabs items="JSON,YAML,TOML" */>}}
{{</* tab */>}}
```json
{ "hello": "world" }
```
{{</* /tab */>}}
... add other tabs similarly
{{</* /tabs */>}}
````
{{< tabs items="JSON,YAML,TOML" >}}
{{< tab >}}
```json
{ "hello": "world" }
```
{{< /tab >}}
{{< tab >}}
```yaml
hello: world
```
{{< /tab >}}
{{< tab >}}
```toml
hello = "world"
```
{{< /tab >}}
{{< /tabs >}}

View File

@ -11,6 +11,7 @@
"cite",
"code",
"del",
"details",
"div",
"em",
"figcaption",
@ -44,6 +45,7 @@
"strong",
"style",
"sub",
"summary",
"sup",
"svg",
"table",
@ -80,10 +82,14 @@
"before:bg-gray-200",
"before:content-[\"\"]",
"before:content-['#']",
"before:content-['']",
"before:inline-block",
"before:inset-0",
"before:inset-y-1",
"before:mr-1",
"before:opacity-25",
"before:pointer-events-none",
"before:transition-transform",
"before:w-px",
"bg-black/[.05]",
"bg-blue-100",
@ -91,6 +97,7 @@
"bg-gradient-to-b",
"bg-gradient-to-r",
"bg-gray-100",
"bg-neutral-50",
"bg-orange-50",
"bg-primary-100",
"bg-primary-400",
@ -150,6 +157,7 @@
"cursor-default",
"cursor-pointer",
"dark:before:bg-neutral-800",
"dark:before:invert",
"dark:bg-blue-900/30",
"dark:bg-dark",
"dark:bg-dark/50",
@ -178,6 +186,7 @@
"dark:hidden",
"dark:hover:bg-gray-100/5",
"dark:hover:bg-neutral-700",
"dark:hover:bg-neutral-800",
"dark:hover:bg-neutral-900",
"dark:hover:bg-primary-100/5",
"dark:hover:bg-primary-700",
@ -250,6 +259,7 @@
"group-data-[theme=dark]:hidden",
"group-data-[theme=light]:hidden",
"group-hover/code:opacity-100",
"group-open:before:rotate-90",
"group/code",
"group/copybtn",
"grow",
@ -267,6 +277,7 @@
"hextra-filetree",
"hextra-filetree-folder",
"hextra-footer",
"hextra-scrollbar",
"hextra-sidebar-collapsible-button",
"hextra-toc",
"hidden",
@ -305,6 +316,7 @@
"justify-start",
"language-options",
"language-switcher",
"last-of-type:mb-0",
"leading-5",
"leading-6",
"leading-7",
@ -312,7 +324,6 @@
"left-[24px]",
"left-[36px]",
"lg:grid-cols-3",
"lg:leading-[1.1]",
"line-clamp-3",
"list-none",
"lntable",
@ -397,6 +408,8 @@
"mx-auto",
"my-1.5",
"my-2",
"nav-container",
"nav-container-blur",
"next-error-h1",
"no-underline",
"not-prose",
@ -413,11 +426,11 @@
"overflow-y-auto",
"overscroll-contain",
"p-0.5",
"p-1",
"p-1.5",
"p-2",
"p-4",
"p-6",
"pb-6",
"pb-8",
"pb-[env(safe-area-inset-bottom)]",
"pb-px",
@ -462,6 +475,7 @@
"rtl:-ml-4",
"rtl:-rotate-180",
"rtl:before:right-0",
"rtl:before:rotate-180",
"rtl:left-1.5",
"rtl:left-3",
"rtl:md:right-auto",
@ -524,6 +538,7 @@
"text-gray-800",
"text-gray-900",
"text-left",
"text-lg",
"text-orange-800",
"text-primary-800",
"text-red-900",
@ -566,4 +581,4 @@
],
"ids": null
}
}
}

View File

@ -4,7 +4,7 @@
<body dir="ltr">
{{- partial "navbar.html" . -}}
{{- block "main" . }}{{ end -}}
{{- if not .Site.Params.footer.disabled }}{{ partial "footer.html" . }}{{ end }}
{{- if (.Site.Params.footer.enable | default true) }}{{ partial "footer.html" . }}{{ end }}
</body>
{{ partial "scripts.html" . }}
</html>

View File

@ -4,6 +4,7 @@
{{ 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)]">
<main class="w-full min-w-0 max-w-6xl px-6 pt-4 md:px-12">
<br class="mt-1.5 text-sm" />
<h1 class="text-center mt-2 text-4xl font-bold tracking-tight text-slate-900 dark:text-slate-100">{{ .Title }}</h1>
<div class="mb-16"></div>
<div class="content">

View File

@ -3,7 +3,8 @@
{{ partial "sidebar.html" (dict "context" . "disableSidebar" true "displayPlaceholder" true) }}
<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">
<h1 class="text-4xl tracking-tighter text-center font-extrabold md:text-5xl mt-8 pb-6">{{ .Title }}</h1>
<br class="mt-1.5 text-sm" />
<h1 class="text-center mt-2 text-4xl font-bold tracking-tight text-slate-900 dark:text-slate-100">{{ .Title }}</h1>
<div class="content">{{ .Content }}</div>
{{ range .Pages.ByDate }}
<div class="mb-10">

View File

@ -14,7 +14,7 @@
{{- partial "utils/icon" (dict "name" "arrow-circle-right" "attributes" "height=14") -}}
</a>
<h1
class="text-4xl font-bold leading-tight tracking-tighter md:text-5xl lg:leading-[1.1] mt-6 bg-clip-text text-transparent bg-gradient-to-r from-gray-900 to-gray-600 dark:from-gray-100 dark:to-gray-400"
class="text-4xl font-bold leading-tight tracking-tighter md:text-5xl mt-6 bg-clip-text text-transparent bg-gradient-to-r from-gray-900 to-gray-600 dark:from-gray-100 dark:to-gray-400"
>
Build modern websites&nbsp;<br class="sm:block hidden" />
with Markdown and Hugo

View File

@ -1,5 +1,5 @@
{{ define "main" }}
<div class="mx-auto flex max-w-screen-xl">
<div class="mx-auto flex max-w-[90rem]">
{{ partial "sidebar.html" (dict "context" . "disableSidebar" true "displayPlaceholder" true) }}
{{ 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)]">

View File

@ -16,7 +16,7 @@
>
<div class="flex w-full flex-col items-center sm:items-start">
{{- if (.Site.Params.footer.displayPoweredBy | default true) }}<div class="font-semibold">{{ template "theme-credit" . }}</div>{{ end }}
{{- if .Site.Params.footer.displayCopyright }}<p class="mt-6 text-xs">{{ $copyright }}</p>{{ end }}
{{- if .Site.Params.footer.displayCopyright }}<p class="mt-6 text-xs">{{ $copyright | markdownify }}</p>{{ end }}
</div>
</div>
</footer>

View File

@ -24,8 +24,10 @@
/* Initialize light/dark mode */
if (localStorage.getItem("color-theme") === "dark" || (!("color-theme" in localStorage) && window.matchMedia("(prefers-color-scheme: dark)").matches)) {
document.documentElement.classList.add("dark");
document.documentElement.style.colorScheme = "dark";
} else {
document.documentElement.classList.remove("dark");
document.documentElement.style.colorScheme = "light";
}
</script>

View File

@ -5,14 +5,14 @@
{{- $logoDarkPath := .Site.Params.navbar.logo.dark | default $logoPath -}}
<div class="sticky top-0 z-20 w-full bg-transparent print:hidden">
<div class="pointer-events-none absolute z-[-1] h-full w-full bg-white shadow-[0_2px_4px_rgba(0,0,0,.02),0_1px_0_rgba(0,0,0,.06)] contrast-more:shadow-[0_0_0_1px_#000] dark:bg-dark dark:shadow-[0_-1px_0_rgba(255,255,255,.1)_inset] contrast-more:dark:shadow-[0_0_0_1px_#fff]"></div>
<div class="nav-container sticky top-0 z-20 w-full bg-transparent print:hidden">
<div class="nav-container-blur pointer-events-none absolute z-[-1] h-full w-full bg-white dark:bg-dark shadow-[0_2px_4px_rgba(0,0,0,.02),0_1px_0_rgba(0,0,0,.06)] contrast-more:shadow-[0_0_0_1px_#000] dark:shadow-[0_-1px_0_rgba(255,255,255,.1)_inset] contrast-more:dark:shadow-[0_0_0_1px_#fff]"></div>
<nav class="mx-auto flex items-center justify-end gap-2 h-16 px-6 max-w-[90rem]">
<a class="flex items-center hover:opacity-75 ltr:mr-auto rtl:ml-auto" href="{{ $logoLink }}">
{{- if (.Site.Params.navbar.displayLogo | default true) }}
<img class="block dark:hidden" src="{{ $logoPath | relURL }}" alt="{{ .Site.Title }}" height="{{ $logoWidth }}" width="{{ $logoHeight }}" />
<img class="hidden dark:block" src="{{ $logoDarkPath | relURL }}" alt="{{ .Site.Title }}" height="{{ $logoWidth }}" width="{{ $logoHeight }}" />
<img class="block dark:hidden" src="{{ $logoPath | relURL }}" alt="{{ .Site.Title }}" height="{{ $logoHeight }}" width="{{ $logoWidth }}" />
<img class="hidden dark:block" src="{{ $logoDarkPath | relURL }}" alt="{{ .Site.Title }}" height="{{ $logoHeight }}" width="{{ $logoWidth }}" />
{{- end }}
{{- if (.Site.Params.navbar.displayTitle | default true) }}
<span class="mx-2 font-extrabold inline select-none" title="{{ .Site.Title }}">{{- .Site.Title -}}</span>

View File

@ -19,7 +19,7 @@
<div>
<ul
class="search-results hidden border border-gray-200 bg-white text-gray-100 dark:border-neutral-800 dark:bg-neutral-900 absolute top-full z-20 mt-2 overflow-auto overscroll-contain rounded-xl py-2.5 shadow-xl max-h-[min(calc(50vh-11rem-env(safe-area-inset-bottom)),400px)] md:max-h-[min(calc(100vh-5rem-env(safe-area-inset-bottom)),400px)] inset-x-0 ltr:md:left-auto rtl:md:right-auto contrast-more:border contrast-more:border-gray-900 contrast-more:dark:border-gray-50 w-screen min-h-[100px] max-w-[min(calc(100vw-2rem),calc(100%+20rem))]"
class="search-results hextra-scrollbar hidden border border-gray-200 bg-white text-gray-100 dark:border-neutral-800 dark:bg-neutral-900 absolute top-full z-20 mt-2 overflow-auto overscroll-contain rounded-xl py-2.5 shadow-xl max-h-[min(calc(50vh-11rem-env(safe-area-inset-bottom)),400px)] md:max-h-[min(calc(100vh-5rem-env(safe-area-inset-bottom)),400px)] inset-x-0 ltr:md:left-auto rtl:md:right-auto contrast-more:border contrast-more:border-gray-900 contrast-more:dark:border-gray-50 w-screen min-h-[100px] max-w-[min(calc(100vw-2rem),calc(100%+20rem))]"
style="transition: max-height 0.2s ease 0s;"
></ul>
</div>

View File

@ -15,7 +15,7 @@
<div class="px-4 pt-4 md:hidden">
{{ partial "search.html" }}
</div>
<div class="overflow-y-auto overflow-x-hidden p-4 grow md:h-[calc(100vh-var(--navbar-height)-var(--menu-height))]">
<div class="hextra-scrollbar overflow-y-auto overflow-x-hidden p-4 grow md:h-[calc(100vh-var(--navbar-height)-var(--menu-height))]">
<ul class="flex flex-col gap-1 md:hidden">
<!-- Nav -->
{{ template "sidebar-main" (dict "context" site.Home "pageURL" $pageURL "page" $context "toc" true) -}}

View File

@ -6,7 +6,7 @@
<nav class="hextra-toc order-last hidden w-64 shrink-0 xl:block print:hidden px-4" aria-label="table of contents">
{{- if $toc }}
<div class="sticky top-16 overflow-y-auto pr-4 pt-6 text-sm [hyphens:auto] max-h-[calc(100vh-var(--navbar-height)-env(safe-area-inset-bottom))] ltr:-mr-4 rtl:-ml-4">
<div class="hextra-scrollbar sticky top-16 overflow-y-auto pr-4 pt-6 text-sm [hyphens:auto] max-h-[calc(100vh-var(--navbar-height)-env(safe-area-inset-bottom))] ltr:-mr-4 rtl:-ml-4">
{{- with .Fragments.Headings -}}
<p class="mb-4 font-semibold tracking-tight">{{ $onThisPage }}</p>
{{- range . -}}

View File

@ -11,24 +11,25 @@
{{- end -}}
{{- $external := strings.HasPrefix $link "http" -}}
{{- $href := cond (strings.HasPrefix $link "/") ($link | relURL) $link -}}
<a
class="hextra-card group flex flex-col justify-start overflow-hidden rounded-lg border border-gray-200 text-current no-underline dark:shadow-none hover:shadow-gray-100 dark:hover:shadow-none shadow-gray-100 active:shadow-sm active:shadow-gray-200 transition-all duration-200 {{ $linkClass }}"
href="{{ $link }}"
{{- if $external -}}
target="_blank"
rel="noreferrer"
href="{{ $href }}"
{{- if $external }}
target="_blank" rel="noreferrer"
{{- end -}}
>
{{- with $image -}}
<img alt="{{ $title }}" loading="lazy" decoding="async" style="color: transparent;" src="{{ $image }}" />
<img alt="{{ $title }}" loading="lazy" decoding="async" style="color: transparent;" src="{{ $image | safeURL }}" />
{{- end -}}
{{ $padding := "p-4"}}
{{- $padding := "p-4" -}}
{{- with $subtitle -}}
{{ $padding = "pt-4 px-4"}}
{{- $padding = "pt-4 px-4" -}}
{{- end -}}
<span class="flex font-semibold items-start gap-2 {{ $padding }} text-gray-700 hover:text-gray-900 dark:text-neutral-200 dark:hover:text-neutral-50">
{{- with $icon }}{{ partial "utils/icon.html" (dict "name" $icon) -}}{{ end -}}
{{- $title -}}

View File

@ -1,8 +1,8 @@
{{- $title := .Get "title" | default "" -}}
{{- $closed := eq (.Get "closed") "true" | default false -}}
<details class="last-of-type:mb-0 rounded-lg bg-neutral-50 dark:bg-neutral-800 p-2 mt-4" data-expanded="true" {{ if not $closed }}open{{ end }}>
<summary class="flex items-center cursor-pointer select-none list-none p-1 transition-colors hover:bg-gray-100 dark:hover:bg-neutral-800 before:mr-1 before:inline-block before:transition-transform before:content-[''] dark:before:invert rtl:before:rotate-180 [[data-expanded]>&]:before:rotate-90">
<details class="last-of-type:mb-0 rounded-lg bg-neutral-50 dark:bg-neutral-800 p-2 mt-4 group" {{ if not $closed }}open{{ end }}>
<summary class="flex items-center cursor-pointer select-none list-none p-1 rounded transition-colors hover:bg-gray-100 dark:hover:bg-neutral-800 before:mr-1 before:inline-block before:transition-transform before:content-[''] dark:before:invert rtl:before:rotate-180 group-open:before:rotate-90">
<strong class="text-lg">{{ $title | markdownify }}</strong>
</summary>
<div class="p-2 overflow-hidden">