Add custom class support for mermaid and button shortcodes

This commit is contained in:
Alex Shpak 2019-06-11 13:40:50 +02:00
parent 2047968370
commit c9d979514c
7 changed files with 16 additions and 6 deletions

View file

@ -28,6 +28,10 @@ $block-border-radius: 0.15rem;
} }
} }
img {
max-width: 100%;
}
code { code {
padding: 0 $padding-4; padding: 0 $padding-4;
background: $gray-100; background: $gray-100;

View file

@ -34,6 +34,10 @@
margin: 0 auto; margin: 0 auto;
} }
.text-center {
text-align: center;
}
@mixin fixed { @mixin fixed {
position: fixed; position: fixed;
top: 0; top: 0;

View file

@ -34,7 +34,7 @@ Miseratus fonte Ditis conubia.
# Buttons # Buttons
```tpl ```tpl
{{</* button relref="/" */>}}Get Home{{</* /button */>}} {{</* button relref="/" [class="..."] */>}}Get Home{{</* /button */>}}
{{</* button href="https://github.com/alex-shpak/hugo-book" */>}}Contribute{{</* /button */>}} {{</* button href="https://github.com/alex-shpak/hugo-book" */>}}Contribute{{</* /button */>}}
``` ```
@ -134,7 +134,7 @@ Miseratus fonte Ditis conubia.
{{< columns >}} {{< columns >}}
```tpl ```tpl
{{</* mermaid */>}} {{</* mermaid [class="text-center"]*/>}}
sequenceDiagram sequenceDiagram
Alice->>Bob: Hello Bob, how are you? Alice->>Bob: Hello Bob, how are you?
alt is sick alt is sick

View file

@ -1 +1 @@
{"Target":"book.min.40a7a4a197e0c73ece96b2afec0d34ad394563de6f97699dd68b042cd2f5ae9e.css","MediaType":"text/css","Data":{"Integrity":"sha256-QKekoZfgxz7OlrKv7A00rTlFY95vl2md1osELNL1rp4="}} {"Target":"book.min.1f05d81b275a862f44a849039ab95c032a03abf4aebe5aeff5367876fc7b68ab.css","MediaType":"text/css","Data":{"Integrity":"sha256-HwXYGydahi9EqEkDmrlcAyoDq/Suvlrv9TZ4dvx7aKs="}}

View file

@ -7,4 +7,6 @@
{{ with .Get "relref" }} {{ with .Get "relref" }}
{{ $ref = relref $ . }} {{ $ref = relref $ . }}
{{ end }} {{ end }}
<a {{ with $ref }} href="{{.}}" {{ end }} {{ with $target }} target="{{.}}" {{ end }} class="book-btn">{{ $.Inner }}</a> <a {{ with $ref }} href="{{.}}" {{ end }} {{ with $target }} target="{{.}}" {{ end }} class="book-btn{{ with .Get "class" }} {{ . }}{{ end }}">
{{ $.Inner }}
</a>

View file

@ -4,6 +4,6 @@
{{ .Page.Scratch.Set "mermaid" true }} {{ .Page.Scratch.Set "mermaid" true }}
{{ end }} {{ end }}
<p class="mermaid"> <p class="mermaid{{ with .Get "class" }} {{ . }}{{ end }}">
{{ .Inner }} {{ .Inner }}
</p> </p>