'Hugo: Expanding fenced code in a post by default?

I'm using Hugo with the LoveIt theme, and when I put a block of Python in my code, whether between code fences or "highlight" tags, it appears in the rendered post collapsed, just a highlighted line with an arrow and the word "Python" that readers have to click to expand.

Is there an option I'm missing to show the whole thing by default or maybe just the first few lines then a "more" arrow to expand fully?



Solution 1:[1]

The answer is in config.toml file. Open it and in about line 336:

[params.page.code]
  copy = true
  maxShownLines = 10

Change the variable maxShownLines from 10 to a larger number, for example: 200, then if your code lines is more than 10, your code block will not fold again in original mode.

maxShownLines = 200

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jan