I have enableEmoji: True and the following content in a page:
~~~
:az:ab:cd:
~~~
It should be rendered as:

But instead I get an emoji :ab: instead of :ab: - picture:

$ hugo version
Hugo Static Site Generator v0.44/extended darwin/amd64 BuildDate: unknown
theme: vjeantet/hugo-theme-docdock [latest]
I confirm the bug. Though, it's a Blackfriday bug and an issue should be opened in Blackfriday's repo instead.
To fool Blackfriday, you can insert the ZERO WIDTH SPACE (0x200b) before the colons. Your code-block won't be then copy/pasteable, but it will atleast display as intended.
Update: Sorry for that misinformation; this is not related to Blackfriday.
I assume this is with enableemoji enabled, in which this is as designed. You can solve this by turning that off.
I assume this is with enableemoji enabled, in which this is as designed.
It's a bug.. why should Blackfriday Hugo render emojis in code blocks?
Update: See https://github.com/gohugoio/hugo/issues/4978#issuecomment-406644015 for clarification.
Blackfriday render emojis in code blocks?
Blackfriday doesn't render any emojis. Emoji is a Unicode character -- if you insert it into a document, the browser renders it.
Blackfriday doesn't render any emojis. Emoji is a Unicode character -- if you insert it into a document, the browser renders it.
Seems like we are talking of different things.
See below (source of Hugo generated HTML from Markdown code block source that OP posted):

<pre><code>:az馃啂cd:
</code></pre>
Blackfriday Hugo replaced the :ab: with that AB emoji i.e. hard-coded it. The browser simply shows that emoji in the default font.
Blackfriday Hugo should have left that :ab: in the <pre>/<code> tags as-is.
Update: But I can see that Hugo probably cannot figure out if the replaced emoji string is in code block or not.
I will repeat it one last time: This isn't a Blackfriday issue.
So then, who is replacing the 4-char string ":ab:" with the Unicode char 馃啂 (0x1F18E) in the HTML?
Update: Sorry, I now realize. It's something that happen between hugo and github.com/kyokomi/emoji? But it's not a "browser rendering" issue too, correct? Because the emoji unicodes are hard-coded in HTML.
Update 2: Found it! (helpers/emoji.go).. So Hugo has no context of where (in code block? in text?) those emoji strings appear.. and it does a blanket search/replace, right?
So Hugo has no context of where (in code block? in text?) those emoji strings appear.. and it does a blanket search/replace, right?
If that鈥檚 true then any attemp to use unformatted text in the page is doomed. Clearly not the way most apps behave.
GitHub for example won鈥檛 replace it:
~
:laughing:
~
Which should not be rendered as: 馃槅
This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.
reopen, still the case. Hugo should not replace emoji in code blocks. Should work as in github
:smile:
:smile:
Same problem here, still on Hugo v0.67.1 (extended)...

Same problem here, still on Hugo v0.67.1 (extended)...
@anup92k LoveIt theme uses a special syntax to escape what you want to display.
https://hugoloveit.com/theme-documentation-content/#escape-character
Thanks ! I didn't understand this part last time.
Most helpful comment
@anup92k LoveIt theme uses a special syntax to escape what you want to display.
https://hugoloveit.com/theme-documentation-content/#escape-character