Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: thegeeklab/hugo-geekdoc
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.3.1
Choose a base ref
...
head repository: thegeeklab/hugo-geekdoc
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.4.0
Choose a head ref
  • 3 commits
  • 14 files changed
  • 1 contributor

Commits on Feb 9, 2025

  1. feat: support hint colors for progress shortcode (#967)

    xoxys authored Feb 9, 2025
    Copy the full SHA
    eecddaf View commit details
  2. feat: add option to set rel attribute in bundle and extra menu (#968)

    xoxys authored Feb 9, 2025
    Copy the full SHA
    f9ff25f View commit details
  3. feat: add basic audio shortcode (#969)

    xoxys authored Feb 9, 2025
    Copy the full SHA
    230075d View commit details
48 changes: 48 additions & 0 deletions exampleSite/content/en/shortcodes/audio/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
title: Audio
resources:
- name: risen
src: "risen.mp3"
title: Risen
params:
credits: "[Sascha Ende on filmmusic.io](https://filmmusic.io/en/song/12856-risen)"
---

The audio shortcode allows you to embed audio files.

## Usage

Define your resources in the page front matter, custom parameter `params.credits` is optional.

<!-- spellchecker-disable -->

```md
---
resources:
- name: risen
src: "risen.mp3"
title: Risen
params:
credits: "[Sascha Ende on filmmusic.io](https://filmmusic.io/en/song/12856-risen)"
---

{{</* audio name="risen" */>}}
```

### Attributes

<!-- prettier-ignore-start -->
<!-- spellchecker-disable -->
{{< propertylist name=shortcode-audio sort=name order=asc >}}
<!-- spellchecker-enable -->
<!-- prettier-ignore-end -->

<!-- spellchecker-enable -->

## Example

<!-- spellchecker-disable -->

{{< audio name="risen" >}}

<!-- spellchecker-enable -->
Binary file not shown.
10 changes: 10 additions & 0 deletions exampleSite/content/en/shortcodes/progress.md
Original file line number Diff line number Diff line change
@@ -24,5 +24,15 @@ A progress bar shows how far a process has progressed.
<!-- prettier-ignore-start -->
<!-- spellchecker-disable -->
{{< progress title=Eating value=65 icon=gdoc_heart >}}

{{< progress title="Type: note" value=10 icon=gdoc_heart type=note >}}

{{< progress title="Type: tip" value=70 icon=gdoc_heart type=tip >}}

{{< progress title="Type: important" value=30 icon=gdoc_heart type=important >}}

{{< progress title="Type: caution" value=90 icon=gdoc_heart type=caution >}}

{{< progress title="Type: warning" value=80 icon=gdoc_heart type=warning >}}
<!-- spellchecker-enable -->
<!-- prettier-ignore-end -->
1 change: 1 addition & 0 deletions exampleSite/data/menu/main.yaml
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ main:
en: Level 1.1 (EN)
de: Level 1.1 (DE)
ref: "/toc-tree/level-1/level-1-1"
rel: me
- name: Level 1.2
ref: "/toc-tree/level-1/level-1-2"
- name: Level 1.3
6 changes: 6 additions & 0 deletions exampleSite/data/properties/shortcode-audio.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
properties:
- name: name
type: string
description: Name of the audio resource defined in page front matter.
required: true
5 changes: 5 additions & 0 deletions exampleSite/data/properties/shortcode-progress.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
properties:
- name: type
type: string
description: Color type of the progress bar. Supported values are `main|note|tip|important|caution|warning`.
required: false
defaultValue: main
- name: value
type: integer
description: Progress value.
3 changes: 3 additions & 0 deletions layouts/partials/menu-bundle.html
Original file line number Diff line number Diff line change
@@ -60,6 +60,9 @@
class="gdoc-nav__entry{{- if not .external }}
{{- if $isCurrent }}{{ printf " is-active" }}{{ end }}
{{- end }}"
{{ if .rel -}}
rel="{{ .rel }}"
{{- end }}
>
{{ $name }}
</a>
3 changes: 3 additions & 0 deletions layouts/partials/menu-extra.html
Original file line number Diff line number Diff line change
@@ -33,6 +33,9 @@
{{ relref $current .ref }}
{{- end }}"
class="gdoc-header__link"
{{ if .rel -}}
rel="{{ .rel }}"
{{- end }}
>
<svg class="gdoc-icon {{ .icon }}">
<title>{{ $name }}</title>
23 changes: 23 additions & 0 deletions layouts/shortcodes/audio.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{- $source := ($.Page.Resources.ByType "audio").GetMatch (printf "%s" (.Get "name")) }}
{{- $customAlt := .Get "alt" }}


{{- with $source }}
{{- $caption := default .Title $customAlt }}

<div class="flex justify-center">
<figure class="gdoc-markdown__figure">
<audio controls class="player" preload="auto">
<source src="{{ .Permalink }}" type="audio/mpeg">
</audio>
{{- with $caption }}
<figcaption>
{{ . }}
{{- with $source.Params.credits }}
{{ printf " (%s)" . | $.Page.RenderString }}
{{- end }}
</figcaption>
{{- end }}
</figure>
</div>
{{- end }}
6 changes: 3 additions & 3 deletions layouts/shortcodes/hint.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{ $type := default "note" (.Get "type") }}
{{ $icon := .Get "icon" }}
{{ $title := default ($type | title) (.Get "title") }}
{{- $type := default "note" (.Get "type") }}
{{- $icon := .Get "icon" }}
{{- $title := default ($type | title) (.Get "title") }}


<blockquote class="gdoc-hint {{ $type | lower }}">
3 changes: 2 additions & 1 deletion layouts/shortcodes/progress.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- $value := default 0 (.Get "value") -}}
{{- $type := default "main" (.Get "type") }}
{{- $title := .Get "title" -}}
{{- $icon := .Get "icon" -}}

@@ -15,7 +16,7 @@
</div>
<div class="gdoc-progress__wrap">
<div
class="gdoc-progress__bar"
class="gdoc-progress__bar {{ $type | lower }}"
data-percent="{{ $value }}"
style="width: {{ $value }}%;"
></div>
4 changes: 4 additions & 0 deletions src/sass/_color_mode.scss
Original file line number Diff line number Diff line change
@@ -95,6 +95,10 @@
filter: saturate(2.5) brightness(0.85);
}

.gdoc-progress__bar {
filter: saturate(0.85) brightness(0.85);
}

.gdoc-hint,
.admonitionblock {
a {
11 changes: 10 additions & 1 deletion src/sass/_markdown.scss
Original file line number Diff line number Diff line change
@@ -100,6 +100,14 @@
max-width: 100%;
height: auto;
}

&:has(audio) {
width: 100%;

audio {
width: 100%;
}
}
}

img {
@@ -109,7 +117,8 @@

blockquote {
margin: defaults.$padding-16 0;
padding: defaults.$padding-8 defaults.$padding-16 defaults.$padding-8 (defaults.$padding-16 - defaults.$padding-4); //to keep total left space 16dp
padding: defaults.$padding-8 defaults.$padding-16 defaults.$padding-8
(defaults.$padding-16 - defaults.$padding-4); //to keep total left space 16dp

border-left: defaults.$border-4 solid var(--accent-color);
border-radius: defaults.$border-radius;
19 changes: 18 additions & 1 deletion src/sass/_shortcodes.scss
Original file line number Diff line number Diff line change
@@ -281,6 +281,23 @@
transparent
);
background-size: 2.5em 2.5em;
background-color: defaults.$main-color !important;
background-color: defaults.$main-color;

@each $name, $color in defaults.$hint-colors {
&.#{$name} {
background-image: linear-gradient(
-45deg,
#{color.scale($color, $lightness: -20%)} 25%,
transparent 25%,
transparent 50%,
#{color.scale($color, $lightness: -20%)} 50%,
#{color.scale($color, $lightness: -20%)} 75%,
transparent 75%,
transparent
);

background-color: $color;
}
}
}
}