hugo-PaperMod icon indicating copy to clipboard operation
hugo-PaperMod copied to clipboard

how to enable code block highlights?

Open cha2hyun opened this issue 1 year ago • 2 comments

Hello, i jsut forked and deploy it through github pages.

I just copy & paste markdown syntax guide in sample page but code block highlights doesnt work. image

url : https://cha2hyun.github.io/posts/etc/markdown-syntac-guide/ repo : https://github.com/cha2hyun/blog/blob/master/content/posts/Etc/markdown%20syntac%20guide.md

any help for this issue ?🙏

cha2hyun avatar Sep 21 '22 05:09 cha2hyun

Self Answer 🥹

  • change the config.yml
  • if anyone has same problem, you might copied config.yml from here(https://github.com/adityatelange/hugo-PaperMod/blob/exampleSite/config.yml) and its default value is disableHLJS:true

config.yml

  assets:
    # disableHLJS: true  <- disable here and highlights will work

cha2hyun avatar Sep 21 '22 05:09 cha2hyun

Looks like you might need to generate the stylesheet: https://github.com/adityatelange/hugo-PaperMod/issues/901

Make sure you link the style once generated (In your config)

The command will look like the one mentioned in the link above:

hugo gen chromastyles --style monokai --highlightStyle 'bg:#474733' > assets/css/extended/monokai.css

TheQueenIsDead avatar Sep 21 '22 09:09 TheQueenIsDead

Looks like you might need to generate the stylesheet:

https://github.com/adityatelange/hugo-PaperMod/issues/901

Make sure you link the style once generated (In your config)

The command will look like the one mentioned in the link above:


hugo gen chromastyles --style monokai --highlightStyle 'bg:#474733' > assets/css/extended/monokai.css

Thanks. thats why my codeblock looks ugly. thanks for help i will try 👍

cha2hyun avatar Sep 22 '22 01:09 cha2hyun

Method for enable code block when copied config.yml from exampleSite

  1. If anyone has code block not highlighting issue like me, you might copied config.yml from here(https://github.com/adityatelange/hugo-PaperMod/blob/exampleSite/config.yml)

  2. Make css file. (thanks for @TheQueenIsDead) Check > #901

# check your assets folder path
# In this command, it generate monokai.css
hugo gen chromastyles --style monokai --highlightStyle 'bg:#474733' > themes/PaperMod/assets/css/extended/monokai.css
  1. edit config.yml
markup:
  highlight:
    style: monokai
  1. done image

cha2hyun avatar Sep 22 '22 02:09 cha2hyun