I am using the pygmentsUseClasses=true
setting on the Hugo Server but i'm receiving short class names like k
for keyword
.
What i want;
<span class="token keyword">const</span>
What i have ;
<span class="k">const</span>
What is missing?
I am using the pygmentsUseClasses=true
setting on the Hugo Server but i'm receiving short class names like k
for keyword
.
What i want;
<span class="token keyword">const</span>
What i have ;
<span class="k">const</span>
What is missing?
I just wandered by on an unrelated search, but if anybody else has this question (confirmed as of 2020-01-19, but Hugo is a moving target):
k
is the class name.
Without classes enabled, you get inline styles in HTML output.
Ex: <span style="color:#66d9ef">const</span>
Hugo uses Chroma instead of Pygments for syntax highlighting now, which surely means that eventually pygmentsUseClasses
will not be recognized. The current documented configuration is markup.highlight.noClasses
:
[markup.highlight]
noClasses = false # instead of pygmentsUseClasses = true
Some external helpers use their own highlighters. These may produce long file names, though it varies by helper. For example, my RST content results in long class names, but my AsciiDoc content does not. If you absolutely must have long class names, try an external helper.
Warning: external helpers affect build time. And like all non-core behavior, there is a risk of deprecation in future Hugo releases.