redmine_highlightjs
redmine_highlightjs copied to clipboard
No highlight in view-source mode
This mode is not regular code block, has table all over screen. Let's see if there is a way to improve that.
I just commited into dev branch one approach to get this working in files view. There are no line numbers and it's still slow, but those files are usually big to highlight. @jwalkerbg @Krakozaber let me know if that helps?
It work, thanks.
But not always correctly determines the language
Language autodetection depends on content and highlightJS lib, I hope they will improve that feature soon. If You don't use so much languages You can compile limited version of lib including only few selected languages, then chances will be higher to get the one You need. You can report in highlightjs support this piece of code - they will have example to improve. I'll take a look at this later and maybe try to add language by extension, this may help. In editor You can always specify right language if autodetection is wrong. For popular languages it usually works.
is this bug fixed?
It is fixed, but not yet complete. I need to add:
- code class depending on file extension
- links to line numbers (this is missing now)
@Krakozaber: please try dev version now, hope autodetection now gets good clue about file highlighting. Let me know if that helped.
File highlighting is based on aliases from highlightJS, it was discussed here: https://github.com/isagalaev/highlight.js/issues/324
unchanged
Any example to check?
Both changes were released into 1.0.2 (master)
Tested version 1.0.2. It works for repository files.However, there is another incompatibility - between this plugin and Redmine Code Review plugin (http://www.redmine.org/plugins/redmine_code_review). Scenario to show bad behaviour:
Installed both plugins.
View some source file from a repository (I tried with a C file) The file appears in the selected theme, well formatted Press link 'Add new review' that is above the file contents. Expected to happen: the page to refresh, add line numbers to the left of each line and next to each line number to appear a small icon (pencil). This icon is a link to create new task (code review) linked to this file and line. What happened: the page refreshed, but line numbers and pencils did not appear. As a result: code review cannot be created.
I have installed the code review plugin too... +1
now the new version makes line numbers removed, so code reviewing won't work anymore...
marilawang , Line numbers are stripped off by highlightjs (http://highlightjs.readthedocs.org/en/latest/line-numbers.html) - this is by design. It seems that codereview and redmine_highlightjs will remain incompatible.
They are stripped by this plugin, not main lib. The reason is that highlightJS lib works with <pre><code>...
block. Redmine by default render this as huge table which I needed to convert into single block. It seems that CodeRay is ready to divide everything into lines, when highlightJS is not. I checked few things and it is not easy to divide nested tags with colors by highlightJS.
Stay cool, I still have some ideas how to merge those. Thanks for raport, at the moment I'm not using code_review plugin, I need to install it and I hope I'll come up with some solution :)