I've been using the highlighting shortcode (eg {{< highlight ini "linenos=table" >}})
to output line numbers into one column and code into another, so I can style numbers separately. Is this feature gone forever unless I fallback to Pygments?
I don't know that it's "gone forever", but it's not supported currently. Keep in mind that Chroma is brand new, as in, 4 months old. I think the Hugo team only heard about it a few weeks ago. Give Alec and the community time to add features, and we'll see how this plays out.
@mckern, please see Alec's comment: https://github.com/alecthomas/chroma/issues/45#issuecomment-332383732.
@mckern, if you set pygmentsUseClasses = true in your site config, you should get something like this that you can style:
<div class="highlight"><pre class="chroma"><code class="language-text" data-lang="text"><span class="ln">1</span>interface Tunnel0
<span class="ln">2</span>description GRE tunnel to other location
<span class="ln">3</span>ip address 192.168.254.1 255.255.255.252
<span class="ln">4</span>tunnel source FastEthernet0/0
<span class="ln">5</span>tunnel destination 172.31.254.1
<span class="ln">6</span>crypto map tunnel-ipsec-map</code></pre>
</div>
Thank you for the suggestion. I tried that but it doesn't work for what I specifically want. Here's an example of what I'm doing -- I use the linenos=table the table has the benefit that line numbers are not copied into the buffer if someone copies lines out of a code block. I can keep using Pygments -- the speed isn't a problem for me. But the incompleteness of the Chroma paired with it being the new default (opt-out instead of it being an opt-in) is frustrating.
@mckern,
Can you use the user-select: none style to accomplish the same thing?
@mckern I do want to add table support, for the exact reason that copy+pasting is much more convenient. It's on The Listâ„¢.
Also note that I kept the options syntax identical between Chrome and Pygments (for several reasons), but that also means that you should just transparently and eventually "get more".
Hey, just chiming in to say thanks for this. The constant iteration and improvement on Hugo is so impressive, and turning around something like this in less than a month? It's amazing. Thanks again.
Most helpful comment
Hey, just chiming in to say thanks for this. The constant iteration and improvement on Hugo is so impressive, and turning around something like this in less than a month? It's amazing. Thanks again.