mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-13 14:15:47 +00:00
feat: add icon shortcode to render icons within Markdown content
See https://sourcethemes.com/academic/docs/writing-markdown-latex/#icons
This commit is contained in:
1 parent
df2e1ed79d
commit
581faa19e7
2 files changed
+27
No files matched your search
@@ -261,4 +261,22 @@ renders as
|
||||
A Markdown aside is useful for displaying notices, hints, or definitions to your readers.
|
||||
{{% /alert %}}
|
||||
|
||||
### Icons
|
||||
|
||||
Academic enables you to use a wide range of [icons from _Font Awesome_ and _Academicons_](https://sourcethemes.com/academic/docs/page-builder/#icons) in addition to [emojis](https://sourcethemes.com/academic/docs/writing-markdown-latex/#emojis).
|
||||
|
||||
Here are some examples using the `icon` shortcode to render icons:
|
||||
|
||||
```markdown
|
||||
{{</* icon name="terminal" pack="fas" */>}} Terminal
|
||||
{{</* icon name="python" pack="fab" */>}} Python
|
||||
{{</* icon name="r-project" pack="fab" */>}} R
|
||||
```
|
||||
|
||||
renders as
|
||||
|
||||
{{< icon name="terminal" pack="fas" >}} Terminal
|
||||
{{< icon name="python" pack="fab" >}} Python
|
||||
{{< icon name="r-project" pack="fab" >}} R
|
||||
|
||||
### Did you find this page helpful? Consider sharing it 🙌
|
||||
@@ -0,0 +1,9 @@
|
||||
{{- if (.Get "name") -}}
|
||||
{{- $icon := .Get "name" -}}
|
||||
{{- $pack := or (.Get "pack") "fas" -}}
|
||||
{{- $pack_prefix := $pack -}}
|
||||
{{- if in (slice "fab" "fas" "far" "fal") $pack -}}
|
||||
{{- $pack_prefix = "fa" -}}
|
||||
{{- end -}}
|
||||
<i class="{{ $pack }} {{ $pack_prefix }}-{{ $icon }} {{with (.Get "padding_left")}}pl-{{.}}{{end}} {{with (.Get "padding_right")}}pr-{{.}}{{end}}"></i>
|
||||
{{- end -}}
|
||||
Reference in new issue
Block a user