huyb1991 / hugo-lamp

A light Hugo AMP responsive theme for blogger ⚡.
https://themes.gohugo.io/theme/hugo-lamp/
MIT License
53 stars 28 forks source link

Add syntax highlighting #68

Closed alastor2831 closed 4 years ago

alastor2831 commented 4 years ago

Is there a way to add syntax highlighting to this theme? I followed the instructions from this post and added

pygmentsUseClasses = true             # Enable for syntax highlighting
pygmentsCodeFences = true             # Enable triple backtick 'code fence' markdown
pygmentsStyle = "dracula"

to the toml and this in my post (back tricks without parenthesis)

(```) r
library(tidyverse)
mtcars >%> filter(mpg == 200) 

but I still don't see any highlighting in the rendered html. I'm using RStudio and I write my posts in RMarkdown if that matters

huyb1991 commented 4 years ago

@nickeatingpizza I believed this related shortcode feature on Hugo and syntax highlight https://gohugo.io/content-management/syntax-highlighting/

Maybe syntax highlight not supporting your code language yet

alastor2831 commented 4 years ago

I use R but I also tried with more common languages but Chroma still doesn't work. I gave up and installed highlight.js. In 5 minutes everything was up and running fine :)

huyb1991 commented 4 years ago

@nickeatingpizza This related syntax support by default on Hugo, can we close this issue?

alastor2831 commented 4 years ago

I guess so, I would rather have Chroma working but anyway 🤷‍♂️