Closed jbrnbrg closed 4 years ago
Hugo provides Syntax highlight by default docs. On my pages I only added these config options
pygmentsCodeFences = true
PygmentsStyle = "monokai"
Should you want to add hightlight.js you can do this like this. Add the highlight.js files to your assets/js
folder and include the file in your config.
[params]
js=["/js/highlight.min.js"]
Hi - thanks for getting back. I am still v new customizing themes. You mentioned that "On my pages I only added these config options" - just to clarify, I should put the following:
pygmentsCodeFences = true
PygmentsStyle = "monokai"
on my config.toml
file under [params]
section or as part of a new section like it shows on the docs:
[markup]
[markup.highlight]
codeFences = true
guessSyntax = false
hl_Lines = ""
lineNoStart = 1
lineNos = false
lineNumbersInTable = true
noClasses = true
style = "monokai"
tabWidth = 4
As an aside, I didn't see pygmentsCodeFences
or PygmentsStyle
on config.toml
within the exampleSite
- thank you again.
Hi,
the pygment settings are on the root level as you can see in the example.
then you should be able to highlight your code with
```sh
ls -la
Hi - yes I've added at root level & style remains unchanged. I suspect I've picked a theme that's a bit above my skill level so I'll be seeing myself out.
Thank you for being responsive.
But the code hightlight should work out-of-the-box from hugo. Maybe you can post how you try to write the code on your page?
Hi - Unfortunately, the syntax highlighting was the last part of the customization I was working on so perhaps I broke something early on in the process? I suspect sharing my code may confuse matters further at this point.
Maybe adding the monokai
syntax highlighting or providing comments on how to use highlight.js
for the exampleSite
of the theme may make it more clear how to use this feature for newbies like me?
No worries for now, tho - I appreciate your responsiveness but I am pursing an alternative theme to meet a deadline. Take care.
I didn't see an option - about how to implement
highlight.js
- is it possible to add some additional clarity about how to include?