Merge pull request #484 from gethinode/shortcode

Refine abbr shortcode
This commit is contained in:
Mark Dumay
2023-08-30 13:13:50 +02:00
committed by GitHub
6 changed files with 46 additions and 5 deletions

View File

@@ -302,6 +302,16 @@ As an example, the following shortcodes render links in different formats.
{{< /example >}}
<!-- markdownlint-enable MD037 -->
## Mark
Use the `mark` shortcode to highlight text. The inner content is used as input.
<!-- markdownlint-disable MD037 -->
{{< example lang="hugo" >}}
Use the mark shortcode to {{</* mark >}}highlight{{< /mark */>}} specific text.
{{< /example >}}
<!-- markdownlint-enable MD037 -->
## Nav
As an example, the following shortcode displays a tab group with vertically aligned pills.

View File

@@ -22,6 +22,7 @@
"input",
"li",
"link",
"mark",
"meta",
"nav",
"nil",
@@ -34,6 +35,8 @@
"small",
"span",
"strong",
"sub",
"sup",
"svg",
"time",
"title",
@@ -439,6 +442,7 @@
"leaflet-map-0",
"link",
"map",
"mark",
"nav",
"nav-0",
"nav-0-0",
@@ -452,6 +456,8 @@
"navbar-sample-collapse",
"release",
"spinner",
"sub",
"sup",
"timeline",
"toast",
"toast-container",

View File

@@ -16,6 +16,7 @@
"link",
"meta",
"nav",
"ol",
"p",
"path",
"script",
@@ -37,9 +38,12 @@
"bg-primary",
"bottom-0",
"bottom-bar",
"breadcrumb",
"breadcrumb-item",
"btn",
"btn-close",
"btn-primary",
"btn-social",
"col",
"col-12",
"col-lg-2",
@@ -80,12 +84,17 @@
"fa-circle-half-stroke",
"fa-ellipsis",
"fa-face-frown",
"fa-facebook",
"fa-fw",
"fa-github",
"fa-link",
"fa-linkedin",
"fa-medium",
"fa-moon",
"fa-share-nodes",
"fa-sun",
"fa-whatsapp",
"fa-x-twitter",
"fab",
"fas",
"feature",
@@ -99,16 +108,21 @@
"fs-3",
"fw-30",
"fw-bold",
"gap-2",
"h-100",
"hstack",
"img-fluid",
"img-wrap",
"invisible",
"is-search",
"justify-content-center",
"lead",
"link-bg-footer",
"link-secondary",
"main-nav-toggler",
"mb-3",
"mb-4",
"mb-5",
"me-auto",
"middle-bar",
"min-vh-100",
@@ -147,11 +161,13 @@
"px-4",
"px-xxl-0",
"py-2",
"py-3",
"py-5",
"py-md-1",
"rounded",
"row",
"row-cols-1",
"row-cols-2",
"row-cols-sm-3",
"row-cols-sm-4",
"search",
@@ -160,10 +176,13 @@
"shadow",
"svg-inline--fa",
"switch-mode-collapsed",
"text-body-secondary",
"text-center",
"text-decoration-none",
"text-end",
"text-secondary",
"text-sm-start",
"text-uppercase",
"theme-icon",
"theme-icon-active",
"toast",
@@ -178,9 +197,11 @@
"ids": [
"-theme",
"-theme-collapsed",
"btn-webshare",
"navbar-0-collapse",
"toast-container",
"toast-copied-code-message"
"toast-copied-code-message",
"toast-message-email-4"
]
}
}

View File

@@ -15,6 +15,8 @@
You can omit the file extension. The file should reside in the "data" folder. The data supports
language extensions. For example, "abbr.en.yaml" refers to the English translation of the
abbrevation data. The filename "abbr.yaml" is used when no suitable translation is found.
"class" Optional class attribute of the abbr element. For example, specify "initialism" for a slightly
smaller font size.
-->
{{ $error := false }}
@@ -33,6 +35,8 @@
{{ $error = true }}
{{ end -}}
{{- $class := .Get "class" -}}
{{ if not $error }}
{{/* Try language-specific file first */}}
{{ $path := path.Join (path.Dir $data) (printf "%s.%s" (path.BaseName $data) .Page.Language.Lang) (path.Ext $data) }}
@@ -59,6 +63,6 @@
{{ end }}
{{ if not $error }}
<abbr title="{{ $title }}">{{ $key }}</abbr>
<abbr {{ with $class }}class="{{ . }}"{{ end }} title="{{ $title }}">{{ $key }}</abbr>
{{ end }}
{{ end }}

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "@gethinode/hinode",
"version": "0.19.0-alpha3",
"version": "0.19.0-beta1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@gethinode/hinode",
"version": "0.19.0-alpha3",
"version": "0.19.0-beta1",
"license": "MIT",
"devDependencies": {
"@fullhuman/postcss-purgecss": "^5.0.0",

View File

@@ -1,6 +1,6 @@
{
"name": "@gethinode/hinode",
"version": "0.19.0-alpha3",
"version": "0.19.0-beta1",
"description": "Hinode is a clean documentation and blog theme for Hugo, an open-source static site generator",
"keywords": [
"hugo",