xianmin / hugo-theme-jane

A readable & concise theme for Hugo
https://xianmin.github.io/hugo-theme-jane/
MIT License
918 stars 285 forks source link

In 58d7b87, code block without language looks weird #343

Closed CyrusYip closed 1 year ago

CyrusYip commented 2 years ago

Solution: https://github.com/xianmin/hugo-theme-jane/issues/343#issuecomment-1242673329

I use hugo v0.99.1.

❯ hugo version
hugo v0.99.1-d524067382e60ce2a2248c3133a1b3af206b6ef1+extended linux/amd64 BuildDate=2022-05-18T11:18:14Z VendorInfo=gohugoio

Reproducible example:

git clone https://github.com/xianmin/hugo-theme-jane.git
cd hugo-theme-jane
git reset --hard 58d7b87
hugo server --contentDir='./exampleSite/content' --config='dev-config.toml'

Visit http://localhost:43909/hugo-theme-jane/post/syntax-highlighting/ in your browser (change 43909 into the port used by your system).

Code blocks with language look normal. Those without language look weird.

image

The example file is exampleSite/content/post/syntax-highlighting.md.

Excerpt ```` ```scala object HelloWorld with Application { Console.println("Hello, World!"); } ``` ```php ``` ```python print("Hello, World!") ``` ## no named code block ``` ## this is a comment $ echo this is a command this is a command ## edit the file $vi foo.md +++ date = "2014-09-28" title = "creating a new theme" +++ bah and humbug :wq ## show it $ cat foo.md +++ date = "2014-09-28" title = "creating a new theme" +++ bah and humbug $ ``` ````
xianmin commented 1 year ago

yes, it's a problem, I wiil think about if there is a good solution. Thank you for your feedback! 😃

oe7drt commented 1 year ago

It would fall back to "fallback" language when guessSyntax = true is set in config file.

[markup]
  [markup.highlight]
    guessSyntax = true

grafik

CyrusYip commented 1 year ago

@oe7drt Your solution works. Thank you.