highlightjs-line-numbers.js
highlightjs-line-numbers.js copied to clipboard
Additional Features
Worked on this over a week ago.
Additional features include the following:
- Line linking.
- Selection Linking.
- Multiple Selection linking.
- Scroll to top selection by link.
This was written specifically to get line numbering and syntax highlighting working with Fossil (an alternative to git). However, the changes should be generally useful otherwise. Can work on the pull request further to make it further compatible as needed.
For an example of how it works, go to https://code.amlegion.org/hljs_line_numbers For a full commit history same link as above.
Ask questions and let me know if further work is needed to progress this.
Note: Also fixes displaying "{1}" on empty lines for some languages (though probably should have been fixed via the format function instead of a quick hack elsewhere).
#7 is fixed with this as well.
@llmII do you still have an example around for this? The link current 404s. I took at look at the other projects hosted (in fossil) but it wasn't clear synax highlighting was available when viewing code (e.g. https://code.amlegion.org/jlogger/file?name=logging/log.lua&ci=tip ). Thanks!
@clach04 look at simplelog.lua. It has syntax highlighting and line numbers (per that link).
We are no longer using highlightjs-line-numbers for this as there's builtin ways to do this with fossil now and I'd have to create a new patch to regain compatibility with the pull request here that is now incompatible with upstream.
I'm happy to help in relation to the fossil/highlighting setup, though we'd need to establish a way to contact each other (maybe look at one of our projects, might list a way to contact me).
The reason you don't see highlighting with jlogger is because it's in the Janet programming language and I'd either have to tweak my hljs to pretend janet files are clojure files or find a syntax highlighter that exists for janet in hljs and I haven't found it necessary to do so at this point in time.
thanks for the speed response @llmII! My interest was more in highlightjs-line-numbers than Fossil.
I'll make time to play with this from your fork :)