-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
highlight.js kills line numbering #556
Comments
Thanks for the report. There are several parameters related to verbatim style, but having just looked again, I'm not sure they're documented very well. 😞 The easiest thing is probably to set I'll take another look. I confess, I've been annoyed by the fact that line numbering is distracting in short snippets too. But I'm also annoyed if short and long snippets are formatted differently, and I'm not sure how to solve both those things simultaneously! |
One problem is that I'll try to improve the documentation in this area. |
Stupid me! I was inferring line numbers being provided separately i.e. in a table column rather than being part of a |
The table column trick kind-of, sort-of works. I have sometimes wondered if it could be implemented more cleanly with modern CSS. The problem with that approach, however, is that the alignment between numbers and lines depends on both columns having the same spacing. Font changes or an inline graphic can make that fail and the result is really ugly. It isn't possible to put the column numbers and lines on the same row (with tr/td markup) because of the same parsing problem. I suppose some JavaScript run after the highlighting finishes might be able to add line numbers. Not sure what hook you could use for that, however. |
There is an |
The highlightjs-line-numbers.js plugin extends So far I could not (yet) figure out how to mix listings with and without line numbers since the beast is being configured on page level. I've filed a related issue |
A quick skim of the source suggests that adding 'nohljsln' to the class attribute would disable it. |
Docbook offers the optional |
I'm somewhat reluctant to change defaults*. An unknown number of users may be relying on the default behavior and it might be easy to miss the change. But I will at least try to make it easier to change the default.
|
Fair enough. But you may as well consider people like myself making the transition from the older (or shall I still say current ?) set of style sheets implementing the For myself its not a big deal either crafting a script changing the sources accordingly or taking advantage of the parameter you inferred for setting the default explicitly. |
That's a point. I didn't realize at the time that I was changing a default from there. |
I have something working, but it's all a bit of a hack. I'm going to think about how maybe things could be restructured so this is easier. |
👍👍 |
Using the default »pygments« highlighter allows for coexistence of highlighting and line numbering honoring the
linenumbering
attribute of e.g.<programlisting>
elements. However using non-defaultverbatim-syntax-highlighter="highlight.js"
works well but no line numbers show up regardless of setting or not setting thelinenumbering
attribute.BTW: Having line numbering activated by default IMHO collides with current Docbook default behavior of line numbering being de-activated. In my document instances ~95% of all
programlisting>
elements are small snippets where line numbering would be distracting. So I would have to add<programlisting linenumbering="unnumbered">
. Is there a transformation parameter allowing to set line numbering off by default?The text was updated successfully, but these errors were encountered: