Skip to content

Commit f0bef18

Browse files
committed
feat: add the spoiler-tag shortcode
0 parents  commit f0bef18

22 files changed

+5621
-0
lines changed

.github/FUNDING.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
github: razonyang
2+
custom:
3+
- https://paypal.me/razonyang

.github/workflows/lint.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: lint
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
lint:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
- uses: actions/setup-node@v4
12+
with:
13+
node-version: 16
14+
- run: npm ci
15+
- run: npm run lint

.github/workflows/release-please.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
6+
permissions:
7+
contents: write
8+
pull-requests: write
9+
10+
name: release-please
11+
12+
jobs:
13+
release-please:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: google-github-actions/release-please-action@v4
17+
with:
18+
command: manifest

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
public/
2+
resources/
3+
.hugo_build.lock
4+
node_modules/

.mergify.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
pull_request_rules:
2+
- name: Automatic merge for Renovate pull requests
3+
conditions:
4+
- author=renovate[bot]
5+
actions:
6+
merge:
7+
method: rebase
8+
9+
- name: Automatic merge on approval
10+
conditions:
11+
- "#approved-reviews-by>=1"
12+
actions:
13+
merge:
14+
method: rebase

.prettierrc

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"plugins": ["prettier-plugin-go-template"],
3+
"bracketSameLine": true,
4+
"goTemplateBracketSpacing": true,
5+
"overrides": [
6+
{
7+
"files": [
8+
"*.html"
9+
],
10+
"options": {
11+
"parser": "go-template",
12+
"bracketSameLine": true
13+
}
14+
}
15+
]
16+
}

.release-please-manifest.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "0.0.1"
3+
}

.stylelintignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/*.tmpl.scss

.stylelintrc.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "stylelint-config-standard-scss",
3+
"rules": {
4+
"at-rule-no-unknown": null,
5+
"color-function-notation": null,
6+
"scss/at-rule-no-unknown": true,
7+
"scss/at-extend-no-missing-placeholder": null
8+
}
9+
}

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 HB Framework Authors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# HB Extended Shortcodes
2+
3+
[![Used By](https://flat.badgen.net/github/dependents-repo/hbstack/shortcodes?icon=github&label=used+by&color=green)](https://github.com/hbstack/shortcodes/network/dependents)
4+
![Hugo Requirements](https://img.shields.io/badge/dynamic/json?color=important&label=requirements&query=requirements&logo=hugo&style=flat-square&url=https://api.razonyang.com/v1/hugo/modules/github.com/hbstack/shortcodes)
5+
[![License](https://flat.badgen.net/github/license/hbstack/shortcodes)](https://github.com/hbstack/shortcodes/blob/main/LICENSE)
6+
[![Version](https://flat.badgen.net/github/tag/hbstack/shortcodes)](https://github.com/hbstack/shortcodes/tags)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.hb-spoiler-tag {
2+
background: var(--#{$prefix}secondary);
3+
color: var(--#{$prefix}secondary);
4+
transition: .5s;
5+
6+
&:hover {
7+
background: inherit;
8+
color: inherit;
9+
}
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@import 'spoiler-tag';

assets/hb/modules/shortcodes/scss/variables.tmpl.scss

Whitespace-only changes.

go.mod

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module github.com/hbstack/shortcodes
2+
3+
go 1.19

hugo.toml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# [module.hugoVersion]
2+
# min = "0.111.3"
3+
4+
[[module.imports]]
5+
path = "github.com/hbstack/hb"
6+
7+
# [params.hb.shortcodes]
8+
9+
# [params.hugopress.modules.hb-shortcodes.hooks.body-end]
10+
# cacheable = true

layouts/shortcodes/spoiler-tag.html

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{{- $text := "" }}
2+
{{- $markdown := false }}
3+
{{- $selectable := false }}
4+
{{- if .IsNamedParams }}
5+
{{- with (.Get "text") }}{{ $text = . }}{{ end }}
6+
{{- with (.Get "markdown") }}{{ $markdown = . }}{{ end }}
7+
{{- with (.Get "selectable") }}{{ $selectable = . }}{{ end }}
8+
{{- else }}
9+
{{- with (.Get 0) }}{{ $text = . }}{{ end }}
10+
{{- with (.Get 1) }}{{ $markdown = . }}{{ end }}
11+
{{- end }}
12+
<span class="hb-spoiler-tag{{ cond $selectable `` ` user-select-none` }}">
13+
{{- with $text }}
14+
{{- . -}}
15+
{{- else }}
16+
{{- cond $markdown (.Page.RenderString .Inner) .Inner -}}
17+
{{- end }}
18+
</span>

0 commit comments

Comments
 (0)