Compare commits

...

26 Commits

Author SHA1 Message Date
Xin
4bf9475701
Merge 9e7b13a0dae76dab674c7ee76f5d1977d77f00a3 into e83c11f31a00c1088cd49e8eaea10b60384921c4 2024-08-12 08:47:51 +02:00
Xin
e83c11f31a
chore: improve tags styling on card (#431)
Some checks failed
Deploy Hugo site to Pages / build (push) Has been cancelled
Deploy Hugo site to Pages / deploy (push) Has been cancelled
* chore: improve tags styling on card

* chore: npm run build:css
2024-08-11 18:47:03 +01:00
Julia March
f439e6bb87
feat: add tag support for card shortcode (#427)
* styles: accept tags on cards with default and custom colors

* styles: compile css
2024-08-11 17:30:19 +01:00
Xin
9c0ba06db4 chore: bump hugo versions 2024-08-11 16:28:59 +00:00
Xin
5c6ed19c34 chore: bump npm package versions 2024-08-11 16:28:19 +00:00
yuri
0986b9ee84
docs: add missing Markdown syntax examples (#415) 2024-08-11 17:03:51 +01:00
jinzhongjia
d2d2a62d5a
docs: fix typo in chinese doc (#430) 2024-08-11 17:01:12 +01:00
Xin
9e7b13a0da chore: add experimental flag for hiding sidebar 2024-05-01 00:02:05 +01:00
Xin
66489e5274 chore: use index as fallback option 2024-04-30 23:56:57 +01:00
Xin
2004648076 fix: class name in render-data 2024-04-30 23:54:06 +01:00
Xin
0da6f97e99 fix: pass in the right page link 2024-04-30 23:03:09 +01:00
Xin
a4bfa2d97e chore: use utils/title to get title 2024-04-30 23:02:36 +01:00
Xin
3a2ce0b5c0 fix: class selector in sidebar.js 2024-04-30 22:44:09 +01:00
Xin
55af474f51 chore: update sidebar item list and link class names 2024-04-30 22:42:04 +01:00
Xin
b91cc79674 Merge remote-tracking branch 'origin/main' into sidebar-data-source 2024-04-30 08:58:06 +01:00
Xin
68e1e25119 feat: caching for sidebar items from data 2024-04-29 22:36:48 +01:00
Xin
8c789626be refactor: move sidebar item styles to css 2024-04-28 23:37:50 +01:00
Xin
a1c7acd6b5 feat: add params page.sidebar.source and page.sidebar.cache 2024-04-14 23:53:53 +01:00
Xin
e444156bb9 refactor: add back mobile and footer for sidebar 2024-04-14 12:28:39 +01:00
Xin
33f2cf653b feat: generate sidebar json data for rendering 2024-04-14 11:31:13 +01:00
Xin
63f153999e chore: basic rendering from data 2024-04-14 11:12:17 +01:00
Xin
c62b1fd401 refactor: make sidebar footer work 2024-04-14 10:23:52 +01:00
Xin
fdfdef69b5 chore: basic structure using new sidebar data 2024-04-05 21:30:24 +01:00
Xin
462cc5b68d chore: add new sidebar template 2024-04-04 21:57:17 +00:00
Xin
f40c7fd5d4 Merge remote-tracking branch 'origin/main' into sidebar-data-source 2024-04-04 20:39:47 +00:00
Xin
74fb165358 feat: sidebar util to read data 2024-04-03 22:36:58 +00:00
26 changed files with 1475 additions and 430 deletions

View File

@ -3,7 +3,7 @@
"features": { "features": {
"ghcr.io/devcontainers/features/hugo:1": { "ghcr.io/devcontainers/features/hugo:1": {
"extended": true, "extended": true,
"version": "0.124.1" "version": "0.131.0"
}, },
"ghcr.io/devcontainers/features/node:1": {} "ghcr.io/devcontainers/features/node:1": {}
}, },

View File

@ -31,7 +31,7 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
HUGO_VERSION: 0.126.1 HUGO_VERSION: 0.131.0
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4

View File

@ -74,7 +74,7 @@
/* CommentPreprocFile */ .chroma .cpf { color: #8b949e; font-weight: bold; font-style: italic } /* CommentPreprocFile */ .chroma .cpf { color: #8b949e; font-weight: bold; font-style: italic }
/* Generic */ .chroma .g { } /* Generic */ .chroma .g { }
/* GenericDeleted */ .chroma .gd { color: #ffa198; background-color: #490202 } /* GenericDeleted */ .chroma .gd { color: #ffa198; background-color: #490202 }
/* GenericEmph */ .chroma .ge { font-style: italic } /* GenericEmph */ .chroma .ge { color: inherit; font-style: italic }
/* GenericError */ .chroma .gr { color: #ffa198 } /* GenericError */ .chroma .gr { color: #ffa198 }
/* GenericHeading */ .chroma .gh { color: #79c0ff; font-weight: bold } /* GenericHeading */ .chroma .gh { color: #79c0ff; font-weight: bold }
/* GenericInserted */ .chroma .gi { color: #56d364; background-color: #0f5323 } /* GenericInserted */ .chroma .gi { color: #56d364; background-color: #0f5323 }

View File

@ -1,5 +1,5 @@
/* /*
! tailwindcss v3.4.3 | MIT License | https://tailwindcss.com ! tailwindcss v3.4.9 | MIT License | https://tailwindcss.com
*//* *//*
1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4) 1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116) 2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
@ -596,10 +596,6 @@ video {
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
} }
.hx-my-1 {
margin-top: 0.25rem;
margin-bottom: 0.25rem;
}
.hx-my-1\.5 { .hx-my-1\.5 {
margin-top: 0.375rem; margin-top: 0.375rem;
margin-bottom: 0.375rem; margin-bottom: 0.375rem;
@ -608,9 +604,6 @@ video {
margin-top: 0.5rem; margin-top: 0.5rem;
margin-bottom: 0.5rem; margin-bottom: 0.5rem;
} }
.-hx-mb-0 {
margin-bottom: -0px;
}
.-hx-mb-0\.5 { .-hx-mb-0\.5 {
margin-bottom: -0.125rem; margin-bottom: -0.125rem;
} }
@ -719,9 +712,6 @@ video {
.hx-h-2 { .hx-h-2 {
height: 0.5rem; height: 0.5rem;
} }
.hx-h-3 {
height: 0.75rem;
}
.hx-h-3\.5 { .hx-h-3\.5 {
height: 0.875rem; height: 0.875rem;
} }
@ -758,9 +748,6 @@ video {
.hx-w-2 { .hx-w-2 {
width: 0.5rem; width: 0.5rem;
} }
.hx-w-3 {
width: 0.75rem;
}
.hx-w-3\.5 { .hx-w-3\.5 {
width: 0.875rem; width: 0.875rem;
} }
@ -888,10 +875,6 @@ video {
.hx-gap-4 { .hx-gap-4 {
gap: 1rem; gap: 1rem;
} }
.hx-gap-x-1 {
-moz-column-gap: 0.25rem;
column-gap: 0.25rem;
}
.hx-gap-x-1\.5 { .hx-gap-x-1\.5 {
-moz-column-gap: 0.375rem; -moz-column-gap: 0.375rem;
column-gap: 0.375rem; column-gap: 0.375rem;
@ -1066,9 +1049,6 @@ video {
-webkit-background-clip: text; -webkit-background-clip: text;
background-clip: text; background-clip: text;
} }
.hx-p-0 {
padding: 0px;
}
.hx-p-0\.5 { .hx-p-0\.5 {
padding: 0.125rem; padding: 0.125rem;
} }
@ -1087,10 +1067,6 @@ video {
.hx-p-6 { .hx-p-6 {
padding: 1.5rem; padding: 1.5rem;
} }
.hx-px-1 {
padding-left: 0.25rem;
padding-right: 0.25rem;
}
.hx-px-1\.5 { .hx-px-1\.5 {
padding-left: 0.375rem; padding-left: 0.375rem;
padding-right: 0.375rem; padding-right: 0.375rem;
@ -1099,6 +1075,10 @@ video {
padding-left: 0.5rem; padding-left: 0.5rem;
padding-right: 0.5rem; padding-right: 0.5rem;
} }
.hx-px-2\.5 {
padding-left: 0.625rem;
padding-right: 0.625rem;
}
.hx-px-3 { .hx-px-3 {
padding-left: 0.75rem; padding-left: 0.75rem;
padding-right: 0.75rem; padding-right: 0.75rem;
@ -2125,7 +2105,7 @@ article details > summary::before {
/* GenericDeleted */ /* GenericDeleted */
.dark .highlight .chroma .gd { color: #ffa198; background-color: #490202 } .dark .highlight .chroma .gd { color: #ffa198; background-color: #490202 }
/* GenericEmph */ /* GenericEmph */
.dark .highlight .chroma .ge { font-style: italic } .dark .highlight .chroma .ge { color: inherit; font-style: italic }
/* GenericError */ /* GenericError */
.dark .highlight .chroma .gr { color: #ffa198 } .dark .highlight .chroma .gr { color: #ffa198 }
/* GenericHeading */ /* GenericHeading */
@ -2258,6 +2238,9 @@ article details > summary::before {
.hextra-cards { .hextra-cards {
grid-template-columns: repeat(auto-fill, minmax(max(250px, calc((100% - 1rem * 2) / var(--hextra-cards-grid-cols))), 1fr)); grid-template-columns: repeat(auto-fill, minmax(max(250px, calc((100% - 1rem * 2) / var(--hextra-cards-grid-cols))), 1fr));
} }
.hextra-card {
position: relative;
}
.hextra-card img { .hextra-card img {
-webkit-user-select: none; -webkit-user-select: none;
-moz-user-select: none; -moz-user-select: none;
@ -2273,6 +2256,7 @@ article details > summary::before {
} }
.hextra-card p { .hextra-card p {
margin-top: 0.5rem; margin-top: 0.5rem;
position: relative;
} }
.dark .hextra-card svg { .dark .hextra-card svg {
color: #ffffff66; color: #ffffff66;
@ -2280,6 +2264,13 @@ article details > summary::before {
.dark .hextra-card:hover svg { .dark .hextra-card:hover svg {
color: currentColor; color: currentColor;
} }
.hextra-card-tag {
position: absolute;
top: 5px;
right: 5px;
z-index: 10;
font-size: .65rem;
}
.steps h3 { .steps h3 {
counter-increment: step; counter-increment: step;
} }
@ -2500,7 +2491,7 @@ nav .search-wrapper {
background-color: rgb(255 255 255 / .85); background-color: rgb(255 255 255 / .85);
--tw-backdrop-blur: blur(12px); --tw-backdrop-blur: blur(12px);
-webkit-backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia); -webkit-backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia); backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
} }
.nav-container-blur:is(html[class~="dark"] *) { .nav-container-blur:is(html[class~="dark"] *) {
background-color: rgb(17 17 17 / 0.8) !important; background-color: rgb(17 17 17 / 0.8) !important;
@ -2575,7 +2566,7 @@ nav .search-wrapper {
--tw-bg-opacity: .85; --tw-bg-opacity: .85;
--tw-backdrop-blur: blur(12px); --tw-backdrop-blur: blur(12px);
-webkit-backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia); -webkit-backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia); backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
} }
.hextra-code-copy-btn:is(html[class~="dark"] *) { .hextra-code-copy-btn:is(html[class~="dark"] *) {
--tw-bg-opacity: 0.8; --tw-bg-opacity: 0.8;
@ -2804,27 +2795,27 @@ body:is(html[class~="dark"] *) {
.hx-group\/copybtn.copied .group-\[\.copied\]\/copybtn\:hx-hidden { .hx-group\/copybtn.copied .group-\[\.copied\]\/copybtn\:hx-hidden {
display: none; display: none;
} }
.data-\[state\=selected\]\:hx-block[data-state=selected] { .data-\[state\=selected\]\:hx-block[data-state="selected"] {
display: block; display: block;
} }
.data-\[state\=closed\]\:hx-hidden[data-state=closed] { .data-\[state\=closed\]\:hx-hidden[data-state="closed"] {
display: none; display: none;
} }
.data-\[state\=open\]\:hx-hidden[data-state=open] { .data-\[state\=open\]\:hx-hidden[data-state="open"] {
display: none; display: none;
} }
.data-\[state\=selected\]\:hx-border-primary-500[data-state=selected] { .data-\[state\=selected\]\:hx-border-primary-500[data-state="selected"] {
--tw-border-opacity: 1; --tw-border-opacity: 1;
border-color: hsl(var(--primary-hue) var(--primary-saturation) 50% / var(--tw-border-opacity)); border-color: hsl(var(--primary-hue) var(--primary-saturation) 50% / var(--tw-border-opacity));
} }
.data-\[state\=selected\]\:hx-text-primary-600[data-state=selected] { .data-\[state\=selected\]\:hx-text-primary-600[data-state="selected"] {
--tw-text-opacity: 1; --tw-text-opacity: 1;
color: hsl(var(--primary-hue) var(--primary-saturation) 45% / var(--tw-text-opacity)); color: hsl(var(--primary-hue) var(--primary-saturation) 45% / var(--tw-text-opacity));
} }
.hx-group[data-theme=dark] .group-data-\[theme\=dark\]\:hx-hidden { .hx-group[data-theme="dark"] .group-data-\[theme\=dark\]\:hx-hidden {
display: none; display: none;
} }
.hx-group[data-theme=light] .group-data-\[theme\=light\]\:hx-hidden { .hx-group[data-theme="light"] .group-data-\[theme\=light\]\:hx-hidden {
display: none; display: none;
} }
@media (prefers-contrast: more) { @media (prefers-contrast: more) {
@ -3369,9 +3360,6 @@ body:is(html[class~="dark"] *) {
display: block; display: block;
} }
} }
.ltr\:hx-right-1:where([dir="ltr"], [dir="ltr"] *) {
right: 0.25rem;
}
.ltr\:hx-right-1\.5:where([dir="ltr"], [dir="ltr"] *) { .ltr\:hx-right-1\.5:where([dir="ltr"], [dir="ltr"] *) {
right: 0.375rem; right: 0.375rem;
} }
@ -3446,9 +3434,6 @@ body:is(html[class~="dark"] *) {
left: auto; left: auto;
} }
} }
.rtl\:hx-left-1:where([dir="rtl"], [dir="rtl"] *) {
left: 0.25rem;
}
.rtl\:hx-left-1\.5:where([dir="rtl"], [dir="rtl"] *) { .rtl\:hx-left-1\.5:where([dir="rtl"], [dir="rtl"] *) {
left: 0.375rem; left: 0.375rem;
} }

View File

@ -2,6 +2,10 @@
grid-template-columns: repeat(auto-fill, minmax(max(250px, calc((100% - 1rem * 2) / var(--hextra-cards-grid-cols))), 1fr)); grid-template-columns: repeat(auto-fill, minmax(max(250px, calc((100% - 1rem * 2) / var(--hextra-cards-grid-cols))), 1fr));
} }
.hextra-card {
position: relative;
}
.hextra-card img { .hextra-card img {
user-select: none; user-select: none;
} }
@ -18,6 +22,7 @@
.hextra-card p { .hextra-card p {
margin-top: 0.5rem; margin-top: 0.5rem;
position: relative;
} }
.dark .hextra-card svg { .dark .hextra-card svg {
@ -27,3 +32,11 @@
.dark .hextra-card:hover svg { .dark .hextra-card:hover svg {
color: currentColor; color: currentColor;
} }
.hextra-card-tag {
position: absolute;
top: 5px;
right: 5px;
z-index: 10;
font-size: .65rem;
}

View File

@ -1,5 +1,5 @@
@media (max-width: 767px) { @media (max-width: 767px) {
.sidebar-container { .hextra-sidebar-container {
@apply hx-fixed hx-pt-[calc(var(--navbar-height))] hx-top-0 hx-w-full hx-bottom-0 hx-z-[15] hx-overscroll-contain hx-bg-white dark:hx-bg-dark; @apply hx-fixed hx-pt-[calc(var(--navbar-height))] hx-top-0 hx-w-full hx-bottom-0 hx-z-[15] hx-overscroll-contain hx-bg-white dark:hx-bg-dark;
transition: transform 0.8s cubic-bezier(0.52, 0.16, 0.04, 1); transition: transform 0.8s cubic-bezier(0.52, 0.16, 0.04, 1);
will-change: transform, opacity; will-change: transform, opacity;
@ -8,7 +8,7 @@
} }
} }
.sidebar-container { .hextra-sidebar-container {
li > div { li > div {
@apply hx-h-0; @apply hx-h-0;
} }
@ -18,4 +18,19 @@
li.open > a > span > svg > path { li.open > a > span > svg > path {
@apply hx-rotate-90; @apply hx-rotate-90;
} }
.hextra-sidebar-item-list {
@apply hx-relative hx-flex hx-flex-col hx-gap-1 before:hx-absolute before:hx-inset-y-1 before:hx-w-px before:hx-bg-gray-200 ltr:hx-ml-3 ltr:hx-pl-3 ltr:before:hx-left-0 rtl:hx-mr-3 rtl:hx-pr-3 rtl:before:hx-right-0 dark:before:hx-bg-neutral-800;
}
.hextra-sidebar-item-link {
@apply hx-flex hx-items-center hx-justify-between hx-gap-2 hx-cursor-pointer hx-rounded hx-px-2 hx-py-1.5 hx-text-sm hx-transition-colors;
&.active {
@apply hx-bg-primary-100 hx-font-semibold hx-text-primary-800 contrast-more:hx-border contrast-more:hx-border-primary-500 dark:hx-bg-primary-400/10 dark:hx-text-primary-600 contrast-more:dark:hx-border-primary-500;
}
&.inactive {
@apply hx-text-gray-500 hover:hx-bg-gray-100 hover:hx-text-gray-900 contrast-more:hx-border contrast-more:hx-border-transparent contrast-more:hx-text-gray-900 contrast-more:hover:hx-border-gray-900 dark:hx-text-neutral-400 dark:hover:hx-bg-primary-100/5 dark:hover:hx-text-gray-50 contrast-more:dark:hx-text-gray-50 contrast-more:dark:hover:hx-border-gray-50;
}
}
} }

View File

@ -3,7 +3,7 @@
document.addEventListener('DOMContentLoaded', function () { document.addEventListener('DOMContentLoaded', function () {
const menu = document.querySelector('.hamburger-menu'); const menu = document.querySelector('.hamburger-menu');
const overlay = document.querySelector('.mobile-menu-overlay'); const overlay = document.querySelector('.mobile-menu-overlay');
const sidebarContainer = document.querySelector('.sidebar-container'); const sidebarContainer = document.querySelector('.hextra-sidebar-container');
// Initialize the overlay // Initialize the overlay
const overlayClasses = ['hx-fixed', 'hx-inset-0', 'hx-z-10', 'hx-bg-black/80', 'dark:hx-bg-black/60']; const overlayClasses = ['hx-fixed', 'hx-inset-0', 'hx-z-10', 'hx-bg-black/80', 'dark:hx-bg-black/60'];

View File

@ -1,3 +1,12 @@
/**
* Check if the element is visible.
* @param {Element} element Dom element
* @returns boolean
*/
function isVisible(element) {
return element.offsetWidth > 0 || element.offsetHeight > 0;
}
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", function () {
const buttons = document.querySelectorAll(".hextra-sidebar-collapsible-button"); const buttons = document.querySelectorAll(".hextra-sidebar-collapsible-button");
buttons.forEach(function (button) { buttons.forEach(function (button) {
@ -5,8 +14,41 @@ document.addEventListener("DOMContentLoaded", function () {
e.preventDefault(); e.preventDefault();
const list = button.parentElement.parentElement; const list = button.parentElement.parentElement;
if (list) { if (list) {
list.classList.toggle("open") list.classList.toggle("open");
} }
}); });
}); });
const isCached = "{{- site.Params.page.sidebar.cache | default false -}}" === "true";
const currentPagePath = window.location.href;
if (isCached) {
// find the current page in the sidebar and open the parent lists
const sidebar = document.querySelector(".hextra-sidebar-container");
if (sidebar) {
// find a tags and compare href with current page path
const links = sidebar.querySelectorAll("a");
links.forEach(function (link) {
const linkPath = link.href;
if (currentPagePath === linkPath) {
// add active class to the link
link.classList.add("active");
link.classList.remove("inactive");
if (!isVisible(link)) {
return;
}
// recursively open parent lists
let parent = link.parentElement;
while (parent && !parent.classList.contains("hextra-sidebar-container")) {
if (parent.tagName === "LI" && parent.classList.contains("hextra-sidebar-item")) {
parent.classList.add("open");
}
parent = parent.parentElement;
}
}
});
}
}
}); });

View File

@ -28,14 +28,28 @@ Hugo از سینتکس [مارک‌داون](https://en.wikipedia.org/wiki/Markd
[^1]: نقل‌قول بالا گزیده‌ای از [سخنرانی](https://www.youtube.com/watch?v=PAAkCSZUG1c) راب پایک در Gopherfest، در تاریخ ۲۷ آبان ۱۳۹۴ است. [^1]: نقل‌قول بالا گزیده‌ای از [سخنرانی](https://www.youtube.com/watch?v=PAAkCSZUG1c) راب پایک در Gopherfest، در تاریخ ۲۷ آبان ۱۳۹۴ است.
```markdown {filename=Markdown}
> با اشتراک‌گذاری حافظه ارتباط برقرار نکنید، حافظه را با برقراری ارتباط به اشتراک بگذارید.<br>
> — <cite>راب پایک[^1]</cite>
[^1]: نقل‌قول بالا گزیده‌ای از [سخنرانی](https://www.youtube.com/watch?v=PAAkCSZUG1c) راب پایک در Gopherfest، در تاریخ ۲۷ آبان ۱۳۹۴ است.
```
### جدول‌ها ### جدول‌ها
جدول‌ها بخشی از مشخصات اصلی مارک‌داون نیستند، اما Hugo از آنها در خارج از جعبه پشتیبانی می‌کند. جدول‌ها بخشی از مشخصات اصلی مارک‌داون نیستند، اما Hugo از آنها در خارج از جعبه پشتیبانی می‌کند.
نام | سن | نام | سن |
--------|------ |--------|------|
گودرز | ۳۰ | گودرز | ۳۰|
آصف | ۳۴ | آصف | ۳۴ |
```markdown {filename=Markdown}
| نام | سن |
|--------|------|
| گودرز | ۳۰|
| آصف | ۳۴ |
```
#### مارک‌داون درون‌خطی درون جدول‌ها #### مارک‌داون درون‌خطی درون جدول‌ها
@ -43,6 +57,12 @@ Hugo از سینتکس [مارک‌داون](https://en.wikipedia.org/wiki/Markd
| -------- | -------- | ------ | | -------- | -------- | ------ |
| *کج* | **توپر** | `کد` | | *کج* | **توپر** | `کد` |
```markdown {filename=Markdown}
| کج | توپر | کد |
| -------- | -------- | ------ |
| *کج* | **توپر** | `کد` |
```
### بلوک‌های کد ### بلوک‌های کد
{{< cards >}} {{< cards >}}
@ -57,12 +77,24 @@ Hugo از سینتکس [مارک‌داون](https://en.wikipedia.org/wiki/Markd
2. دومین آیتم 2. دومین آیتم
3. سومین آیتم 3. سومین آیتم
```markdown {filename=Markdown}
1. اولین آیتم
2. دومین آیتم
3. سومین آیتم
```
#### فهرست مرتب‌نشده #### فهرست مرتب‌نشده
* فهرست آیتم * فهرست آیتم
* یک آیتم دیگه * یک آیتم دیگه
* و یک آیتم دیگه * و یک آیتم دیگه
```markdown {filename=Markdown}
* فهرست آیتم
* یک آیتم دیگه
* و یک آیتم دیگه
```
#### فهرست تو در تو #### فهرست تو در تو
* میوه * میوه
@ -73,13 +105,31 @@ Hugo از سینتکس [مارک‌داون](https://en.wikipedia.org/wiki/Markd
* شیر * شیر
* پنیر * پنیر
```markdown {filename=Markdown}
* میوه
* سیب
* پرتقال
* موز
* لبنیات
* شیر
* پنیر
```
### عکس‌ها ### عکس‌ها
![](https://source.unsplash.com/featured/800x600?landscape) ![landscape](https://source.unsplash.com/featured/800x600?landscape)
```markdown {filename=Markdown}
![landscape](https://source.unsplash.com/featured/800x600?landscape)
```
با توضیحات: با توضیحات:
![](https://source.unsplash.com/featured/800x600?landscape "یک چشم‌انداز Unsplash") ![landscape](https://source.unsplash.com/featured/800x600?landscape "یک چشم‌انداز Unsplash")
```markdown {filename=Markdown}
![landscape](https://source.unsplash.com/featured/800x600?landscape "یک چشم‌انداز Unsplash")
```
## پیکربندی ## پیکربندی

View File

@ -28,14 +28,28 @@ Blockquote with attribution
[^1]: The above quote is excerpted from Rob Pike's [talk](https://www.youtube.com/watch?v=PAAkCSZUG1c) during Gopherfest, November 18, 2015. [^1]: The above quote is excerpted from Rob Pike's [talk](https://www.youtube.com/watch?v=PAAkCSZUG1c) during Gopherfest, November 18, 2015.
```markdown {filename=Markdown}
> Don't communicate by sharing memory, share memory by communicating.<br>
> — <cite>Rob Pike[^1]</cite>
[^1]: The above quote is excerpted from Rob Pike's [talk](https://www.youtube.com/watch?v=PAAkCSZUG1c) during Gopherfest, November 18, 2015.
```
### Tables ### Tables
Tables aren't part of the core Markdown spec, but Hugo supports them out-of-the-box. Tables aren't part of the core Markdown spec, but Hugo supports them out-of-the-box.
Name | Age | Name | Age |
--------|------ |--------|------|
Bob | 27 | Bob | 27 |
Alice | 23 | Alice | 23 |
```markdown {filename=Markdown}
| Name | Age |
|--------|------|
| Bob | 27 |
| Alice | 23 |
```
#### Inline Markdown within tables #### Inline Markdown within tables
@ -43,6 +57,12 @@ Tables aren't part of the core Markdown spec, but Hugo supports them out-of-the-
| -------- | -------- | ------ | | -------- | -------- | ------ |
| *italics* | **bold** | `code` | | *italics* | **bold** | `code` |
```markdown {filename=Markdown}
| Italics | Bold | Code |
| -------- | -------- | ------ |
| *italics* | **bold** | `code` |
```
### Code Blocks ### Code Blocks
{{< cards >}} {{< cards >}}
@ -57,12 +77,24 @@ Tables aren't part of the core Markdown spec, but Hugo supports them out-of-the-
2. Second item 2. Second item
3. Third item 3. Third item
```markdown {filename=Markdown}
1. First item
2. Second item
3. Third item
```
#### Unordered List #### Unordered List
* List item * List item
* Another item * Another item
* And another item * And another item
```markdown {filename=Markdown}
* List item
* Another item
* And another item
```
#### Nested list #### Nested list
* Fruit * Fruit
@ -73,13 +105,31 @@ Tables aren't part of the core Markdown spec, but Hugo supports them out-of-the-
* Milk * Milk
* Cheese * Cheese
```markdown {filename=Markdown}
* Fruit
* Apple
* Orange
* Banana
* Dairy
* Milk
* Cheese
```
### Images ### Images
![](https://source.unsplash.com/featured/800x600?landscape) ![landscape](https://source.unsplash.com/featured/800x600?landscape)
```markdown {filename=Markdown}
![landscape](https://source.unsplash.com/featured/800x600?landscape)
```
With caption: With caption:
![](https://source.unsplash.com/featured/800x600?landscape "Unsplash Landscape") ![landscape](https://source.unsplash.com/featured/800x600?landscape "Unsplash Landscape")
```markdown {filename=Markdown}
![landscape](https://source.unsplash.com/featured/800x600?landscape "Unsplash Landscape")
```
## Configuration ## Configuration

View File

@ -28,14 +28,28 @@ Hugo 支持 [Markdown](https://en.wikipedia.org/wiki/Markdown) 来书写内容
[^1]: The above quote is excerpted from Rob Pike's [talk](https://www.youtube.com/watch?v=PAAkCSZUG1c) during Gopherfest, November 18, 2015. [^1]: The above quote is excerpted from Rob Pike's [talk](https://www.youtube.com/watch?v=PAAkCSZUG1c) during Gopherfest, November 18, 2015.
```markdown {filename=Markdown}
> Don't communicate by sharing memory, share memory by communicating.<br>
> — <cite>Rob Pike[^1]</cite>
[^1]: The above quote is excerpted from Rob Pike's [talk](https://www.youtube.com/watch?v=PAAkCSZUG1c) during Gopherfest, November 18, 2015.
```
### 表格 ### 表格
表格并非核心 Markdown 规范,但 Hugo 支持开箱即用的表格: 表格并非核心 Markdown 规范,但 Hugo 支持开箱即用的表格:
Name | Age | Name | Age |
--------|------ |--------|------|
Bob | 27 | Bob | 27 |
Alice | 23 | Alice | 23 |
```markdown {filename=Markdown}
| Name | Age |
|--------|------|
| Bob | 27 |
| Alice | 23 |
```
#### Markdown 表格中的内联 #### Markdown 表格中的内联
@ -43,6 +57,12 @@ Hugo 支持 [Markdown](https://en.wikipedia.org/wiki/Markdown) 来书写内容
| -------- | -------- | ------ | | -------- | -------- | ------ |
| *italics* | **bold** | `code` | | *italics* | **bold** | `code` |
```markdown {filename=Markdown}
| Italics | Bold | Code |
| -------- | -------- | ------ |
| *italics* | **bold** | `code` |
```
### 代码块 ### 代码块
{{< cards >}} {{< cards >}}
@ -57,12 +77,24 @@ Hugo 支持 [Markdown](https://en.wikipedia.org/wiki/Markdown) 来书写内容
2. Second item 2. Second item
3. Third item 3. Third item
```markdown {filename=Markdown}
1. First item
2. Second item
3. Third item
```
#### 无序列表 #### 无序列表
* List item * List item
* Another item * Another item
* And another item * And another item
```markdown {filename=Markdown}
* List item
* Another item
* And another item
```
#### 嵌套列表 #### 嵌套列表
* Fruit * Fruit
@ -73,13 +105,31 @@ Hugo 支持 [Markdown](https://en.wikipedia.org/wiki/Markdown) 来书写内容
* Milk * Milk
* Cheese * Cheese
```markdown {filename=Markdown}
* Fruit
* Apple
* Orange
* Banana
* Dairy
* Milk
* Cheese
```
### 图片 ### 图片
![](https://source.unsplash.com/featured/800x600?landscape) ![landscape](https://source.unsplash.com/featured/800x600?landscape)
```markdown {filename=Markdown}
![landscape](https://source.unsplash.com/featured/800x600?landscape)
```
带有标题: 带有标题:
![](https://source.unsplash.com/featured/800x600?landscape "Unsplash Landscape") ![landscape](https://source.unsplash.com/featured/800x600?landscape "Unsplash Landscape")
```markdown {filename=Markdown}
![landscape](https://source.unsplash.com/featured/800x600?landscape "Unsplash Landscape")
```
## 配置 ## 配置

View File

@ -6,7 +6,7 @@ prev: /docs/guide
## 目录结构 ## 目录结构
默认情况下Hugo 在 `context` 目录中搜索 Markdown 文件,目录的结构决定了网站的最终输出结构。 默认情况下Hugo 在 `content` 目录中搜索 Markdown 文件,目录的结构决定了网站的最终输出结构。
以示例网站为例: 以示例网站为例:
<!--more--> <!--more-->

View File

@ -7,11 +7,12 @@ linkTitle: Cards
{{< cards >}} {{< cards >}}
{{< card link="../callout" title="Callout" icon="warning" >}} {{< card link="../callout" title="Callout" icon="warning" >}}
{{< card link="../callout" title="Card with tag" icon="tag" tag="custom tag">}}
{{< card link="/" title="No Icon" >}} {{< card link="/" title="No Icon" >}}
{{< /cards >}} {{< /cards >}}
{{< cards >}} {{< cards >}}
{{< card link="/" title="Image Card" image="https://source.unsplash.com/featured/800x600?landscape" subtitle="Unsplash Landscape" >}} {{< card link="/" title="Image Card" image="https://github.com/user-attachments/assets/71b7e3ec-1a8d-4582-b600-5425c6cc0407" subtitle="Internet Image" >}}
{{< card link="/" title="Local Image" image="/images/card-image-unprocessed.jpg" subtitle="Raw image under static directory." >}} {{< card link="/" title="Local Image" image="/images/card-image-unprocessed.jpg" subtitle="Raw image under static directory." >}}
{{< card link="/" title="Local Image" image="images/space.jpg" subtitle="Image under assets directory, processed by Hugo." method="Resize" options="600x q80 webp" >}} {{< card link="/" title="Local Image" image="images/space.jpg" subtitle="Image under assets directory, processed by Hugo." method="Resize" options="600x q80 webp" >}}
{{< /cards >}} {{< /cards >}}
@ -21,6 +22,7 @@ linkTitle: Cards
``` ```
{{</* cards */>}} {{</* cards */>}}
{{</* card link="../callout" title="Callout" icon="warning" */>}} {{</* card link="../callout" title="Callout" icon="warning" */>}}
{{</* card link="../callout" title="Card with tag" icon="warning" tag= "A custom tag" */>}}
{{</* card link="/" title="No Icon" */>}} {{</* card link="/" title="No Icon" */>}}
{{</* /cards */>}} {{</* /cards */>}}
``` ```
@ -35,13 +37,15 @@ linkTitle: Cards
## Card Parameters ## Card Parameters
| Parameter | Description | | Parameter | Description |
|----------- |---------------------------------------| |----------- |-----------------------------------------------------------------|
| `link` | URL (internal or external). | | `link` | URL (internal or external). |
| `title` | Title heading for the card. | | `title` | Title heading for the card. |
| `subtitle` | Subtitle heading (supports Markdown). | | `subtitle` | Subtitle heading (supports Markdown). |
| `icon` | Name of the icon. | | `icon` | Name of the icon. |
| `tag` | Text in tag. |
| `tagColor` | Color of the tag: `gray` (default), `yellow`, `red` and `blue`. |
## Image Card ## Image Card
Additionally, the card supports adding image and processing through these parameters: Additionally, the card supports adding image and processing through these parameters:
@ -62,3 +66,24 @@ Hextra auto-detects if image processing is needed during build and applies the `
It currently supports these `method`: `Resize`, `Fit`, `Fill` and `Crop`. It currently supports these `method`: `Resize`, `Fit`, `Fill` and `Crop`.
For more on Hugo's built in image processing commands, methods, and options see their [Image Processing Documentation](https://gohugo.io/content-management/image-processing/). For more on Hugo's built in image processing commands, methods, and options see their [Image Processing Documentation](https://gohugo.io/content-management/image-processing/).
## Tags
Card supports adding tags which could be useful to show extra status information.
{{< cards >}}
{{< card link="../callout" title="Card with default tag" tag="tag text" >}}
{{< card link="../callout" title="Card with error tag" tag="tag text" tagType="error" >}}
{{< card link="../callout" title="Card with info tag" tag="tag text" tagType="info" >}}
{{< card link="../callout" title="Card with warning tag" tag="tag text" tagType="warning" >}}
{{< card link="/" title="Image Card" image="https://github.com/user-attachments/assets/71b7e3ec-1a8d-4582-b600-5425c6cc0407" subtitle="Internet Image" tag="tag text" tagType="error" >}}
{{< /cards >}}
```
{{</* cards */>}}
{{</* card link="../callout" title="Card with default tag color" tag="tag text" */>}}
{{</* card link="../callout" title="Card with default red tag" tag="tag text" tagType="error" */>}}
{{</* card link="../callout" title="Card with blue tag" tag="tag text" tagType="info" */>}}
{{</* card link="../callout" title="Card with yellow tag" tag="tag text" tagType="warning" */>}}
{{</* /cards */>}}
```

View File

@ -211,6 +211,7 @@
"hextra-card-icon", "hextra-card-icon",
"hextra-card-image", "hextra-card-image",
"hextra-card-subtitle", "hextra-card-subtitle",
"hextra-card-tag",
"hextra-cards", "hextra-cards",
"hextra-code-block", "hextra-code-block",
"hextra-code-copy-btn", "hextra-code-copy-btn",
@ -418,6 +419,7 @@
"hx-pt-8", "hx-pt-8",
"hx-px-1.5", "hx-px-1.5",
"hx-px-2", "hx-px-2",
"hx-px-2.5",
"hx-px-3", "hx-px-3",
"hx-px-4", "hx-px-4",
"hx-px-6", "hx-px-6",
@ -480,6 +482,7 @@
"hx-text-white", "hx-text-white",
"hx-text-xl", "hx-text-xl",
"hx-text-xs", "hx-text-xs",
"hx-text-xxs",
"hx-text-yellow-900", "hx-text-yellow-900",
"hx-to-gray-600", "hx-to-gray-600",
"hx-top-0", "hx-top-0",

View File

@ -0,0 +1,12 @@
{{- range site.Menus.sidebar }}
{{- $name := or (T .Identifier) .Name }}
{{- if eq .Params.type "separator" }}
<li class="[word-break:break-word] hx-mt-5 hx-mb-2 hx-px-2 hx-py-1.5 hx-text-sm hx-font-semibold hx-text-gray-900 first:hx-mt-0 dark:hx-text-gray-100">
<span class="hx-cursor-default">{{ $name }}</span>
</li>
{{- else }}
<li>
{{- partial "components/sidebar/item-link" (dict "active" false "title" $name "link" (.URL | relLangURL)) -}}
</li>
{{- end }}
{{- end -}}

View File

@ -0,0 +1,5 @@
<span class="hextra-sidebar-collapsible-button">
<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" class="hx-h-[18px] hx-min-w-[18px] hx-rounded-sm hx-p-0.5 hover:hx-bg-gray-800/5 dark:hover:hx-bg-gray-100/5">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" class="hx-origin-center hx-transition-transform rtl:-hx-rotate-180"></path>
</svg>
</span>

View File

@ -0,0 +1,51 @@
{{- $context := . -}}
{{- $pages := union .RegularPages .Sections -}}
{{- $pages = where $pages "Params.sidebar.exclude" "!=" true -}}
{{- $data := slice -}}
{{- range $pages.ByWeight -}}
{{ $structure := (partial "sidebar/section-walk" .) | unmarshal -}}
{{ $data = $data | append $structure -}}
{{ end -}}
{{- define "partials/sidebar/section-walk" -}}
{{- with . -}}
{
"title": "{{ partial "utils/title" . }}",
"link": "{{ .RelPermalink }}",
"toc": {{ partial "sidebar/section-page-toc" . }},
"open": {{ .Params.sidebar.open | default false }}
{{- if .IsSection }},
"items": [
{{ $pages := union .RegularPages .Sections -}}
{{ $pages = where $pages "Params.sidebar.exclude" "!=" true -}}
{{ range $index, $page := $pages.ByWeight -}}
{{ partial "sidebar/section-walk" . }}{{ if not (ge $index (sub (len $pages) 1)) }},{{ end -}}
{{ end -}}
]
{{ end -}}
}
{{- end }}
{{- end -}}
{{- define "partials/sidebar/section-page-toc" -}}
{{/* Get level 2 headings list used mainly for mobile navigation */}}
[
{{- with .Fragments.Headings -}}
{{/* Loop over level 1 headings */}}
{{- range . }}
{{- with .Headings }}
{{ $headings := . }}
{{- range $index, $heading := $headings }}
{{ $heading.Title | jsonify (dict "noHTMLEscape" true) }}
{{- if not (ge $index (sub (len $headings) 1)) }},{{ end -}}
{{ end -}}
{{- end -}}
{{ end -}}
{{- end -}}
]
{{- end -}}
{{ return ($data | jsonify (dict "noHTMLEscape" true)) }}

View File

@ -0,0 +1,20 @@
{{/* Get section sidebar config from Hugo `data` directory
If the site is multilingual, the sidebar data is stored in a language-specific
directory. For example, the English sidebar data is stored in `data/en/sidebar.yaml`.
*/}}
{{ $data := "" }}
{{ $section := .Section | default "index" }}
{{ $filename := "sidebar" }}
{{ if hugo.IsMultilingual }}
{{ with (index site.Data site.Language.Lang $filename $section) }}
{{ $data = . }}
{{ end }}
{{ else }}
{{ with (index site.Data $filename $section) }}
{{ $data = . }}
{{ end }}
{{ end }}
{{ return $data }}

View File

@ -0,0 +1,18 @@
{{- $external := strings.HasPrefix .link "http" -}}
{{- $activeClass := cond (.active) "active" "inactive" -}}
<a
class="hextra-sidebar-item-link {{ $activeClass }} [-webkit-tap-highlight-color:transparent] [-webkit-touch-callout:none] [word-break:break-word]"
href="{{ .link }}"
{{ if $external }}target="_blank" rel="noreferer"{{ end }}
>
{{- .title -}}
{{- with .context }}
{{- if or .RegularPages .Sections }}
{{- partialCached "components/sidebar/collapsible-button" . }}
{{- end }}
{{ end -}}
{{- with .items }}{{- partialCached "components/sidebar/collapsible-button" site.Home }}{{ end -}}
</a>

View File

@ -0,0 +1,16 @@
{{- $page := .page -}}
{{- $pageLink := $page.RelPermalink -}}
{{- $cached := .cached | default false }}
{{- range .data -}}
{{- $active := and (not $cached) (or (eq $pageLink .link) (eq (strings.TrimSuffix "/" $pageLink) .link)) -}}
{{- $containsPage := hasPrefix $pageLink .link -}}
{{- $shouldOpen := or (.open) $containsPage $active | default false -}}
<li class="hextra-sidebar-item {{ if $shouldOpen }}open{{ end }}">
{{- partial "components/sidebar/item-link" (dict "active" $active "title" .title "link" .link "items" .items) -}}
{{- if .items -}}
{{- partial "components/sidebar/render-items" (dict "items" .items "link" $pageLink "cached" $cached) -}}
{{- end -}}
</li>
{{ end }}

View File

@ -0,0 +1,21 @@
{{- $items := .items -}}
{{- $pageLink := .link -}}
{{- $cached := .cached | default false }}
<div class="ltr:hx-pr-0 hx-overflow-hidden">
<ul class="hextra-sidebar-item-list">
{{- range $items }}
{{- $active := and (not $cached) (or (eq $pageLink .link) (eq (strings.TrimSuffix "/" $pageLink) .link)) -}}
{{- $containsPage := hasPrefix $pageLink .link -}}
{{- $shouldOpen := or (.open) $containsPage $active | default false -}}
<li class="hextra-sidebar-item hx-flex hx-flex-col {{ if $shouldOpen }}open{{ end }}">
{{- partial "components/sidebar/item-link" (dict "active" $active "title" .title "link" .link "items" .items) -}}
{{- if .items -}}
{{- partial "components/sidebar/render-items" (dict "items" .items "link" $pageLink "cached" $cached) -}}
{{- end -}}
</li>
{{- end -}}
</ul>
</div>

View File

@ -4,7 +4,7 @@
{{- $jsLang := resources.Get "js/lang.js" -}} {{- $jsLang := resources.Get "js/lang.js" -}}
{{- $jsCodeCopy := resources.Get "js/code-copy.js" -}} {{- $jsCodeCopy := resources.Get "js/code-copy.js" -}}
{{- $jsFileTree := resources.Get "js/filetree.js" -}} {{- $jsFileTree := resources.Get "js/filetree.js" -}}
{{- $jsSidebar := resources.Get "js/sidebar.js" -}} {{- $jsSidebar := resources.Get "js/sidebar.js" | resources.ExecuteAsTemplate "sidebar.js" . -}}
{{- $jsBackToTop := resources.Get "js/back-to-top.js" -}} {{- $jsBackToTop := resources.Get "js/back-to-top.js" -}}
{{- $scripts := slice $jsTheme $jsMenu $jsCodeCopy $jsTabs $jsLang $jsFileTree $jsSidebar $jsBackToTop | resources.Concat "js/main.js" -}} {{- $scripts := slice $jsTheme $jsMenu $jsCodeCopy $jsTabs $jsLang $jsFileTree $jsSidebar $jsBackToTop | resources.Concat "js/main.js" -}}

View File

@ -7,6 +7,8 @@
{{- $width := .width -}} {{- $width := .width -}}
{{- $height := .height -}} {{- $height := .height -}}
{{- $imageStyle := .imageStyle -}} {{- $imageStyle := .imageStyle -}}
{{- $tag := .tag -}}
{{- $tagType := .tagType -}}
{{ $linkClass := "hover:hx-border-gray-300 hx-bg-transparent hx-shadow-sm dark:hx-border-neutral-800 hover:hx-bg-slate-50 hover:hx-shadow-md dark:hover:hx-border-neutral-700 dark:hover:hx-bg-neutral-900" }} {{ $linkClass := "hover:hx-border-gray-300 hx-bg-transparent hx-shadow-sm dark:hx-border-neutral-800 hover:hx-bg-slate-50 hover:hx-shadow-md dark:hover:hx-border-neutral-700 dark:hover:hx-bg-neutral-900" }}
{{- with $image -}} {{- with $image -}}
@ -50,5 +52,17 @@
{{- with $subtitle -}} {{- with $subtitle -}}
<div class="hextra-card-subtitle hx-line-clamp-3 hx-text-sm hx-font-normal hx-text-gray-500 dark:hx-text-gray-400 hx-px-4 hx-mb-4 hx-mt-2">{{- $subtitle | markdownify -}}</div> <div class="hextra-card-subtitle hx-line-clamp-3 hx-text-sm hx-font-normal hx-text-gray-500 dark:hx-text-gray-400 hx-px-4 hx-mb-4 hx-mt-2">{{- $subtitle | markdownify -}}</div>
{{- end -}} {{- end -}}
{{- if $tag }}
{{ $defaultClass := "hx-text-gray-600 hx-text-xxs hx-bg-gray-100 dark:hx-bg-neutral-800 dark:hx-text-neutral-200" }}
{{ $warningClass := "hx-border-yellow-100 hx-bg-yellow-50 hx-text-yellow-900 dark:hx-border-yellow-200/30 dark:hx-bg-yellow-700/30 dark:hx-text-yellow-200" }}
{{ $infoClass := "hx-border-blue-200 hx-bg-blue-100 hx-text-blue-900 dark:hx-border-blue-200/30 dark:hx-bg-blue-900/30 dark:hx-text-blue-200" }}
{{ $errorClass := "hx-border-red-200 hx-bg-red-100 hx-text-red-900 dark:hx-border-red-200/30 dark:hx-bg-red-900/30 dark:hx-text-red-200" }}
{{ $tagClass := cond (eq $tagType "info") $infoClass (cond (eq $tagType "warning") $warningClass (cond (eq $tagType "error") $errorClass $defaultClass)) }}
<div class="hextra-card-tag">
<span class="hx-inline-block hx-rounded-full hx-px-2.5 hx-leading-6 {{ $tagClass }}">{{ $tag }}</span>
</div>
{{- end -}}
</a> </a>
{{- /* Strip trailing newline. */ -}} {{- /* Strip trailing newline. */ -}}

View File

@ -0,0 +1,95 @@
{{- $context := .context -}}
{{- $disableSidebar := .disableSidebar | default false -}}
{{- $displayPlaceholder := .displayPlaceholder | default false -}}
{{- $sidebarClass := cond $disableSidebar (cond $displayPlaceholder "md:hx-hidden xl:hx-block" "md:hx-hidden") "md:hx-sticky" -}}
{{- $navRoot := cond (eq site.Home.Type "docs") site.Home $context.FirstSection -}}
{{- $pageURL := $context.RelPermalink -}}
{{- $data := slice -}}
{{- $dataMobile := slice -}}
{{- if (eq site.Params.page.sidebar.source "data") -}}
{{ $data = partialCached "components/sidebar/get-section-data" $context $context.Section }}
{{- $dataMobile = $data -}}
{{- else -}}
{{- $data = (partialCached "components/sidebar/generate-section-data" $navRoot $navRoot) | unmarshal -}}
{{- $dataMobile = (partialCached "components/sidebar/generate-section-data" site.Home site.Home) | unmarshal -}}
{{- end -}}
{{- $shouldCache := site.Params.page.sidebar.cache | default false -}}
{{/* EXPERIMENTAL */}}
{{- if .context.Params.sidebar.hide -}}
{{- $disableSidebar = true -}}
{{- $displayPlaceholder = true -}}
{{- end -}}
<div class="mobile-menu-overlay [transition:background-color_1.5s_ease] hx-fixed hx-inset-0 hx-z-10 hx-bg-black/80 dark:hx-bg-black/60 hx-hidden"></div>
<aside class="hextra-sidebar-container hx-flex hx-flex-col print:hx-hidden md:hx-top-16 md:hx-shrink-0 md:hx-w-64 md:hx-self-start max-md:[transform:translate3d(0,-100%,0)] {{ $sidebarClass }}">
{{/* Search bar on small screen */}}
{{- partialCached "components/sidebar/mobile-search" . -}}
<div class="hextra-scrollbar hx-overflow-y-auto hx-overflow-x-hidden hx-p-4 hx-grow md:hx-h-[calc(100vh-var(--navbar-height)-var(--menu-height))]">
{{/* Mobile Navigation */}}
<ul class="hx-flex hx-flex-col hx-gap-1 md:hx-hidden">
{{- with $dataMobile -}}
{{- partial "components/sidebar/render-data" (dict "data" . "page" $context) -}}
{{- end -}}
</ul>
{{/* Sidebar on large screen */}}
{{- if $disableSidebar -}}
{{- if $displayPlaceholder }}<div class="max-xl:hx-hidden hx-h-0 hx-w-64 hx-shrink-0"></div>{{ end -}}
{{ .context.Scratch.Set "enableFooterSwitches" true }}
{{- else -}}
<ul class="hx-flex hx-flex-col hx-gap-1 max-md:hx-hidden">
{{- with $data -}}
{{- if $shouldCache -}}
{{- partialCached "components/sidebar/render-data" (dict "data" . "page" $context "cached" $shouldCache) $navRoot -}}
{{- else -}}
{{- partial "components/sidebar/render-data" (dict "data" . "page" $context "cached" $shouldCache) -}}
{{- end -}}
{{- end -}}
{{- partialCached "components/sidebar/bottom" $context site.Home -}}
</ul>
{{ end -}}
</div>
{{- partial "components/sidebar/switches" (dict "context" $context "disableSidebar" $disableSidebar) -}}
</aside>
{{- define "partials/components/sidebar/mobile-search" -}}
<div class="hx-px-4 hx-pt-4 md:hx-hidden">
{{- partialCached "search.html" . -}}
</div>
{{- end -}}
{{- define "partials/components/sidebar/switches" -}}
{{- $context := .context -}}
{{- $disableSidebar := .disableSidebar -}}
{{/* Hide theme switch when sidebar is disabled */}}
{{ $switchesClass := cond $disableSidebar "md:hx-hidden" "" -}}
{{ $displayThemeToggle := (site.Params.theme.displayToggle | default true) -}}
{{ if or site.IsMultiLingual $displayThemeToggle }}
<div
class="{{ $switchesClass }} {{ with site.IsMultiLingual }}
hx-justify-end
{{ end }} hx-sticky hx-bottom-0 hx-bg-white dark:hx-bg-dark hx-mx-4 hx-py-4 hx-shadow-[0_-12px_16px_#fff] hx-flex hx-items-center hx-gap-2 dark:hx-border-neutral-800 dark:hx-shadow-[0_-12px_16px_#111] contrast-more:hx-border-neutral-400 contrast-more:hx-shadow-none contrast-more:dark:hx-shadow-none hx-border-t"
data-toggle-animation="show"
>
{{- with site.IsMultiLingual -}}
{{- partial "language-switch" (dict "context" $context "grow" true) -}}
{{- with $displayThemeToggle }}{{ partial "theme-toggle" (dict "hideLabel" true) }}{{ end -}}
{{- else -}}
{{- with $displayThemeToggle -}}
<div class="hx-flex hx-grow hx-flex-col">{{ partial "theme-toggle" }}</div>
{{- end -}}
{{- end -}}
</div>
{{- end -}}
{{- end -}}

View File

@ -7,6 +7,8 @@
{{- $width := 0 -}} {{- $width := 0 -}}
{{- $height := 0 -}} {{- $height := 0 -}}
{{- $imageStyle := .Get "imageStyle" -}} {{- $imageStyle := .Get "imageStyle" -}}
{{- $tag := .Get "tag" -}}
{{- $tagType := .Get "tagType" -}}
{{/* Image processing options */}} {{/* Image processing options */}}
{{- $method := .Get "method" | default "Resize" | humanize -}} {{- $method := .Get "method" | default "Resize" | humanize -}}
@ -48,5 +50,7 @@
"width" $width "width" $width
"height" $height "height" $height
"imageStyle" $imageStyle "imageStyle" $imageStyle
"tag" $tag
"tagType" $tagType
) )
-}} -}}

1264
package-lock.json generated

File diff suppressed because it is too large Load Diff