-
-
Notifications
You must be signed in to change notification settings - Fork 806
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
Wrapped lines are numbered in source blocks with very long lines #1706
Comments
This problem is related to line numbering. There are few things going on here. First, the nowrap option is not honored in this scenario. So if you add You almost have to use |
To clarify, the focus of this issue is to get the nowrap option to work when using table-based line numbers. I don't know what else we can do address it. I guess down the road we could switch to using individual table rows for each line number and corresponding line of source code, but that would be a major change to the HTML and stylesheet. |
It appears this is a general problem with source highlighting libraries. The authors of those libraries often recommend disabling line wrapping when using line numbers. |
We should probably document this as well. |
I'd even consider automatically enabling nowrap when line numbers are on. That might save people a lot of hassle. |
@mojavelinux I think enabling nowrap option automatically will be much better. BTW is there any workaround this until this is fixed. |
@mojavelinux Just figured out what you meant. So this works for now. Hope for a fix in next milestone. :-) |
Correct. One way to fix it is to use the inline linenums mode. The other way to fix it is to apply a patch to the stylesheet that sets the |
One of the important advantages of line numbering, in my opinion, is that it allows content to be wrapped while still showing the reader where the original line breaks were. With regular wrapping, line breaks are added as required and the user may not be sure where the real line breaks actually were (an important detail in some cases). Alternatives include adding icons for where the real line breaks are or disabling wrapping, but neither of these work as nicely as line numbering. Just my thoughts— Here is the workaround that Dan mentioned in the previous comment, as I understand it. When added to a docinfo.html, the following CSS disables wrapping and enables horizontal scrolling for a syntax-highlighted source block with line numbering enabled. This is currently the best option for me because it allows me to still use the
If all line lengths are kept below the wrapped length, the Asciidoctor-PDF |
It turns out, there was a bug in the CodeRay stylesheet with linenums in table mode. The nested I also documented in the user manual that you must set |
When having very long lines in a source block that are wrapped, the wrapped lines are also numbered, so that the last lines are not numbered.
When you render this document:
the project element is wrapped over 4 lines, so that the last 3 lines are not getting any line numbers.
Tried both with coderay and with pygments.
The text was updated successfully, but these errors were encountered: