Corretions

This commit is contained in:
Alex 2019-03-12 00:53:47 +02:00 committed by Bjørn Erik Pedersen
parent 4a9e2433df
commit 92cfcd67f5
10 changed files with 22 additions and 231 deletions

View file

@ -31,37 +31,8 @@ font-family: Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,And
}
{{< /highlight >}}
***
If you feel restricted by Unicode Standard emoji and want to use custom emoji the [`replaceRE`](https://gohugo.io/functions/replacere/#readout) function makes it easy to perform Static Image Replacement in Hugo.
In this example we will be using emoji from the [Mutant Standard](https://mutant.tech/) set.
- Do not use `enableEmoji` in your Hugo project's configuration
- Store the icons of the custom emoji set under `/static/`
- Use the shorthand codes provided by the custom emoji set in your content files e.g. `:orc:`
- In your templates execute the Image Replacement like so:
{{< highlight html >}}
{{ replaceRE "(\\:([a-zA-Z0-9_]*)\\:)" `<img class="emoji" src="/${2}.svg" alt="${1}" title="${1}">` .Content | markdownify | safeHTML }}
{{< /highlight >}}
{{< css.inline >}}
<p>{{ replaceRE "(\\ :([a-zA-Z0-9_]*)\\: )" `<img class="emoji" src="/${2}.svg" alt="${1}" title="${1}">` .Page.Params.emoji | safeHTML }}</p>
<style>
.emoji {
display: inline-block;
margin-left: 3px;
margin-right: 3px;
height: 5.5rem;
width: 5.5rem;
vertical-align: middle;
}
.emojify {
font-family: Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,Android Emoji,EmojiSymbols;
font-size: 5rem;
@ -74,7 +45,4 @@ In this example we will be using emoji from the [Mutant Standard](https://mutant
}
}
</style>
{{< /css.inline >}}
**N.B.** The above RegEx captures all alphanumerics and underscores within two colon `:` characters (amend it according to your custom emoji set's specification).
{{< /css.inline >}}