Compare commits

...

5 Commits

Author SHA1 Message Date
Xin
36ab5287b5 docs: fix favicon customization instruction
Some checks are pending
Deploy Hugo site to Pages / build (push) Waiting to run
Deploy Hugo site to Pages / deploy (push) Blocked by required conditions
2024-09-22 22:41:07 +01:00
Xin
9173f59392 fix: replace deprecated resources.PostCSS (#458) 2024-09-22 22:16:33 +01:00
Xin
c70900c25f feat: add badge shortcode (#457)
* feat: move badge to a separate partial

* feat: badge shortcode

* docs: add badge shortcode examples

* chore: generate css

* docs: add spaces between badges
2024-09-22 22:12:22 +01:00
cabdb421e3 Update cards.md (#456)
Some checks are pending
Deploy Hugo site to Pages / build (push) Waiting to run
Deploy Hugo site to Pages / deploy (push) Blocked by required conditions
Fix incorrect icon in example
2024-09-22 09:59:21 +01:00
Xin
de9f9b312e fix: jupyter styling not applied (#454)
Some checks failed
Deploy Hugo site to Pages / build (push) Has been cancelled
Deploy Hugo site to Pages / deploy (push) Has been cancelled
2024-09-14 23:53:43 +01:00
14 changed files with 131 additions and 33 deletions

View File

@ -1176,6 +1176,9 @@ video {
.hx-text-4xl { .hx-text-4xl {
font-size: 2.25rem; font-size: 2.25rem;
} }
.hx-text-\[\.65rem\] {
font-size: .65rem;
}
.hx-text-\[10px\] { .hx-text-\[10px\] {
font-size: 10px; font-size: 10px;
} }
@ -2269,7 +2272,6 @@ article details > summary::before {
top: 5px; top: 5px;
right: 5px; right: 5px;
z-index: 10; z-index: 10;
font-size: .65rem;
} }
.steps h3 { .steps h3 {
counter-increment: step; counter-increment: step;
@ -2577,6 +2579,27 @@ nav .search-wrapper {
grid-template-columns: repeat(var(--hextra-feature-grid-cols), minmax(0, 1fr)) grid-template-columns: repeat(var(--hextra-feature-grid-cols), minmax(0, 1fr))
} }
} }
.hextra-jupyter-code-cell {
scrollbar-gutter: auto;
margin-top: 1.5rem;
}
.hextra-jupyter-code-cell .hextra-jupyter-code-cell-outputs-container {
overflow: hidden;
font-size: .75rem;
}
.hextra-jupyter-code-cell .hextra-jupyter-code-cell-outputs-container .hextra-jupyter-code-cell-outputs {
max-height: 50vh;
overflow: auto;
}
.hextra-jupyter-code-cell .hextra-jupyter-code-cell-outputs-container .hextra-jupyter-code-cell-outputs pre {
max-width: 100%;
overflow: auto;
font-size: .75rem;
}
.hextra-badge {
display: inline-flex;
align-items: center;
}
html { html {
font-size: 1rem; font-size: 1rem;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;

View File

@ -0,0 +1,3 @@
.hextra-badge {
@apply hx-inline-flex hx-items-center;
}

View File

@ -38,5 +38,4 @@
top: 5px; top: 5px;
right: 5px; right: 5px;
z-index: 10; z-index: 10;
font-size: .65rem;
} }

View File

@ -3,27 +3,15 @@
@apply hx-mt-6; @apply hx-mt-6;
.hextra-jupyter-code-cell-source {
@apply hx-text-sm;
.chroma,
pre {
@apply hx-m-0;
}
}
.hextra-jupyter-code-cell-outputs-container { .hextra-jupyter-code-cell-outputs-container {
@apply hx-text-xs hx-overflow-hidden hx-border hx-border-t-0 hx-rounded-b-xl dark:hx-border-neutral-800; @apply hx-text-xs hx-overflow-hidden;
.hextra-jupyter-code-cell-outputs { .hextra-jupyter-code-cell-outputs {
@apply hx-overflow-auto hx-max-h-[50vh]; @apply hx-overflow-auto hx-max-h-[50vh];
pre { pre {
@apply hx-p-4; @apply hx-text-xs hx-overflow-auto hx-max-w-full;
} }
} }
} }
} }
.hextra-jupyter-code-cell:has(.hextra-jupyter-code-cell-outputs) .hextra-jupyter-code-cell-source .chroma {
@apply hx-rounded-b-none;
}

View File

@ -10,6 +10,8 @@
@import "components/scrollbar.css"; @import "components/scrollbar.css";
@import "components/code-copy.css"; @import "components/code-copy.css";
@import "components/hextra/feature-grid.css"; @import "components/hextra/feature-grid.css";
@import "components/jupyter.css";
@import "components/badge.css";
html { html {
@apply hx-text-base hx-antialiased; @apply hx-text-base hx-antialiased;

View File

@ -186,10 +186,10 @@ To customize the [favicon](https://en.wikipedia.org/wiki/Favicon) for your site,
{{< /filetree/folder >}} {{< /filetree/folder >}}
{{< /filetree/container >}} {{< /filetree/container >}}
Include both `favicon.ico` and `favicon.svg` files in your project to ensure your site's favicons display correctly. Include `favicon.ico`, `favicon.svg` and `favicon-dark.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. While `favicon.ico` is generally for older browsers, `favicon.svg` and `favicon-dark.svg` are supported by modern browsers.
Feel free to use tools like [favicon.io](https://favicon.io/) or [favycon](https://github.com/ruisaraiva19/favycon) to generate these icons. Use tools like [favicon.io](https://favicon.io/) or [favycon](https://github.com/ruisaraiva19/favycon) to generate such icons.
### Theme Configuration ### Theme Configuration

View File

@ -22,7 +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="../callout" title="Card with tag" icon="tag" tag= "A custom tag" */>}}
{{</* card link="/" title="No Icon" */>}} {{</* card link="/" title="No Icon" */>}}
{{</* /cards */>}} {{</* /cards */>}}
``` ```

View File

@ -10,6 +10,41 @@ sidebar:
These shortcodes are considered less stable and may be changed anytime. These shortcodes are considered less stable and may be changed anytime.
{{< /callout >}} {{< /callout >}}
## Badge
```
{{</* badge "Badge" */>}}
```
Result:
{{< badge "Badge" >}}
Variants:
```
{{</* badge content="info" type="info" */>}}
{{</* badge content="warning" type="warning" */>}}
{{</* badge content="error" type="error" */>}}
```
Result:
{{< badge content="info" type="info" >}} &nbsp;
{{< badge content="warning" type="warning" >}} &nbsp;
{{< badge content="error" type="error" >}}
With link:
```
{{</* badge content="Releases" link="https://github.com/imfing/hextra/releases" */>}}
```
Result:
{{< badge content="Releases" link="https://github.com/imfing/hextra/releases" >}}
## YouTube ## YouTube
Embed a YouTube video. Embed a YouTube video.

View File

@ -209,6 +209,7 @@
"group-hover:hx-underline", "group-hover:hx-underline",
"group-open:before:hx-rotate-90", "group-open:before:hx-rotate-90",
"hamburger-menu", "hamburger-menu",
"hextra-badge",
"hextra-card", "hextra-card",
"hextra-card-icon", "hextra-card-icon",
"hextra-card-image", "hextra-card-image",
@ -464,6 +465,7 @@
"hx-sticky", "hx-sticky",
"hx-text-2xl", "hx-text-2xl",
"hx-text-4xl", "hx-text-4xl",
"hx-text-[.65rem]",
"hx-text-[10px]", "hx-text-[10px]",
"hx-text-[color:hsl(var(--primary-hue),100%,50%)]", "hx-text-[color:hsl(var(--primary-hue),100%,50%)]",
"hx-text-base", "hx-text-base",
@ -488,7 +490,6 @@
"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

@ -1,6 +1,6 @@
{{- if and (not hugo.IsProduction) (eq hugo.Environment "theme") }} {{- if and (not hugo.IsProduction) (eq hugo.Environment "theme") }}
{{- $styles := resources.Get "css/styles.css" }} {{- $styles := resources.Get "css/styles.css" }}
{{- $styles = $styles | resources.PostCSS (dict "inlineImports" true) }} {{- $styles = $styles | postCSS (dict "inlineImports" true) }}
<link href="{{ $styles.RelPermalink }}" rel="stylesheet" /> <link href="{{ $styles.RelPermalink }}" rel="stylesheet" />
{{- else }} {{- else }}
{{- $styles := resources.Get "css/compiled/main.css" -}} {{- $styles := resources.Get "css/compiled/main.css" -}}

View File

@ -0,0 +1,16 @@
{{- $content := .content -}}
{{- $type := .type -}}
{{- $class := .class | default "" -}}
{{- $border := .border | default false -}}
{{- $defaultClass := "hx-text-gray-600 hx-bg-gray-100 dark:hx-bg-neutral-800 dark:hx-text-neutral-200 hx-border-gray-200 dark:hx-border-neutral-700" -}}
{{- $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" -}}
{{- $borderClass := cond (eq $border true) "hx-border" "" -}}
{{- $badgeClass := cond (eq $type "info") $infoClass (cond (eq $type "warning") $warningClass (cond (eq $type "error") $errorClass $defaultClass)) -}}
<div class="hextra-badge {{ $class }}">
<div class="hx-inline-flex hx-items-center hx-rounded-full hx-px-2.5 hx-leading-6 hx-text-[.65rem] {{ $borderClass }} {{ $badgeClass }}">{{- $content -}}</div>
</div>
{{- /* Strip trailing newline. */ -}}

View File

@ -54,15 +54,13 @@
{{- end -}} {{- end -}}
{{- if $tag }} {{- if $tag }}
{{ $defaultClass := "hx-text-gray-600 hx-text-xxs hx-bg-gray-100 dark:hx-bg-neutral-800 dark:hx-text-neutral-200" }} {{- partial "shortcodes/badge.html" (dict
{{ $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" }} "content" $tag
{{ $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" }} "type" $tagType
{{ $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" }} "class" "hextra-card-tag"
"border" true
{{ $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 -}} {{- end -}}
</a> </a>
{{- /* Strip trailing newline. */ -}} {{- /* Strip trailing newline. */ -}}

View File

@ -0,0 +1,33 @@
{{- if .IsNamedParams -}}
{{- $content := .Get "content" -}}
{{- $type := .Get "type" | default "" -}}
{{- $class := .Get "class" | default "" -}}
{{- $link := .Get "link" | default "" -}}
{{- if $link -}}
<a href="{{ $link }}" title="{{ $content | plainify }}" target="_blank">
{{- partial "shortcodes/badge.html" (dict
"content" $content
"type" $type
"class" $class
"border" true
)
-}}
</a>
{{- else -}}
{{- partial "shortcodes/badge.html" (dict
"content" $content
"type" $type
"class" $class
"border" true
)
-}}
{{- end -}}
{{- else -}}
{{- $content := .Get 0 -}}
{{- partial "shortcodes/badge.html" (dict
"content" $content
"border" true
)
-}}
{{- end -}}

View File

@ -53,12 +53,12 @@
{{- else if eq (index $output "output_type") "stream" -}} {{- else if eq (index $output "output_type") "stream" -}}
{{- $text := index $output "text" -}} {{- $text := index $output "text" -}}
{{- $textContent := (cond (reflect.IsSlice $text) (delimit $text "") $text) -}} {{- $textContent := (cond (reflect.IsSlice $text) (delimit $text "") $text) -}}
<pre class="not-prose hx-text-sm">{{- $textContent -}}</pre> <pre class="not-prose">{{- $textContent -}}</pre>
{{- else if eq (index $output "output_type") "execute_result" -}} {{- else if eq (index $output "output_type") "execute_result" -}}
{{- $data := index $output "data" -}} {{- $data := index $output "data" -}}
{{- $text := index $data "text/plain" -}} {{- $text := index $data "text/plain" -}}
{{- $textContent := (cond (reflect.IsSlice $text) (delimit $text "") $text) -}} {{- $textContent := (cond (reflect.IsSlice $text) (delimit $text "") $text) -}}
<pre class="not-prose hx-text-sm">{{- $textContent -}}</pre> <pre class="not-prose">{{- $textContent -}}</pre>
{{- $html := index $data "text/html" -}} {{- $html := index $data "text/html" -}}
{{- if $html -}} {{- if $html -}}
{{- $htmlText := delimit $html "" -}} {{- $htmlText := delimit $html "" -}}