-
-
Notifications
You must be signed in to change notification settings - Fork 194
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
Display line numbers when viewing source code #328
Comments
I think line numbers should be generally useful for everyone, no need to make it an option. There are line numbers on GitHub as well and you cannot configure it. :) I've implemented the necessary changes in main...mhils:linenumbers, but we first need to wait for a pygments fix to ship in pygments/pygments#2026. |
Sounds great, but as you changed the title (no mention to links now) I am a bit confused. The "option" proposal was because file sizes will increase when adding line numbers (and even more with link anchors). Probably not a problem for anyone (not for me). |
Yes, line numbers are clickable and should auto-expand. :) |
I would like to add something else related to source code readability. Is it possible to wrap long lines of source code so they continue on the next line, instead of current overflowing below the right border? I mean really long lines (at least 80 characters, and only if they overflow). Many could say my source code should already contain line breaks, but sometimes it's not that simple:
|
How long do you expect that wait can be? |
The PR has been merged, so it will be part of the next pygments release. I don't think there's any urgency and we shouldn't bother them with it. They seem to do frequent releases, and we can wait for their regular next one. :) |
I’m afraid you got me wrong. I wasn’t trying to force any pdoc changes with my comments in #343 Sorry again |
Problem Description
Two related enhancement proposals:
Proposal
view-source
at the right side of a function definition (or Class, or whatever), source code lines are shown.Is it possible that these lines come with the line number shown on the left side? (as an option, like many text editors offer)
<span class="sd">source code</span>
If each
span
is preceded with a<a name="lnXXXX">
tag, then that line (number XXXX) would be linkable using module.html#lnXXXXAlternatives
pdoc.render.configure(show_line_numbers: bool)
view-source
on the right sidepdoc.render.configure(create_line_anchors: bool)
Probably this would imply that
view-source
should be active by default in rendered html output as well, not needing to click anywhere (otherwise, module.html#lnXXXX links to specific span tag anchors won't do anything if those span tags are not already visible whenmodule.html
is loaded).Additional context
https://pdoc.dev/docs/pdoc/render.html#configure
https://pdoc.dev/docs/pdoc/doc.html#Doc.source_lines
Useful to complement use case described in #325 and specially in #327
The text was updated successfully, but these errors were encountered: