Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor I
11 Views

Syntax highlighted code in documentation

Something for the suggestion box: I think it would be great if the Fortran code snippets in the HTML documentation were syntax highlighted. I've gotten to the point where I can't look at non-syntax highlighted code without my eyes bleeding. :)

0 Kudos
10 Replies
Highlighted
11 Views

Thanks for the suggestion - I'll pass it on. I don't think I've seen a single syntax highlighter that works well enough for Fortran to deal with this, though.

0 Kudos
Highlighted
New Contributor I
11 Views

The new syntax-highlighted documentation looks great! Now they just need to fix the display of comment lines. Example here: https://software.intel.com/en-us/node/679950

0 Kudos
Highlighted
11 Views

I see they are using the same (or similar) highlighter used in the forum. It doesn't understand submodule and other new constructs. My guess is that the documentation team made a deliberate choice not to color comment lines, but I will ask.

0 Kudos
Highlighted
Black Belt
11 Views

Another related problem: English words such as "not" and "real" that are part of a line-end comment or comment line are highlighted as if they were operators and keywords. See, for example, the 140-line example code at https://software.intel.com/en-us/node/679950 .

I often have a hard time distinguishing extensions to Fortran from Standard Fortran because, with background shading, slight differences in the darkness of gray text is not enough to tell them apart: for example, look for "This color" in the third table of https://software.intel.com/en-us/node/677893 .

0 Kudos
Highlighted
11 Views

I was not aware that extensions were shaded in such a difficult to distinguish color. I will ask the documentation people to work on that.

The syntax highlighter is fairly stupid - it doesn't know to not highlight things in comments. I'll see what can be done about that. The doc folk told me what they are using and I enhanced it to understand F2008 keywords and also changed the comment color. If you want to try it, unzip the attached to 

C:\Program Files (x86)\IntelSWTools\compilers_and_libraries\windows\documentation\en\compiler_f\common\core\resources\prism

and then browse the on-disk documentation.

Let me know what you think.

0 Kudos
Highlighted
New Contributor III
11 Views

Hi Steve,

the syntax highlighting is great. Many thanks to the team!

The online version looks very nice with the above mentioned minor issues. The offline local help version could be better. However, the modified version is much better than the original one. I read through the lines of the css and js files and it seems to be quite easy to adjust colors to my own like. I made the comment's green darker to increase the contrast and changed string/char to look more like the VS standard highlighting (dark red in my case).

If somebody like to change colors, my way I did it:

  1. Find the 'keyword' for '*'-symbol in the prism.js -> operator.
  2. In the prism.css you will find 'token.operator'.
  3. From other token entities you can copy and change color and font adjustments

e.g. for black bold operators

.token.operator{
	color: #000000;
	font-weight: bold;
},

Line numbers in the offline-docu would also be great. I don't understand how it works, but maybe the development team can add it (http://prismjs.com/plugins/line-numbers/). In my opinion, it would be less confusing, if the online and offline docu syntax highlighting would look more similar.

Are there plans to add syntax highlighting for the PDF version too?

Best regards, Johannes

ps: I attached my changes, if anybody likes to test them...

0 Kudos
Highlighted
11 Views

I will make the suggestions to add line numbers. Do keep in mind that any changes you make to the prismjs scripts will be overwritten on the next install. I'll also pass on the suggestions for the PDF version, though I am unsure if that would be as simple.

0 Kudos
Highlighted
11 Views

Ok, here's another shot at the prism files that I think addresses most if not all of the issues raised here. Comments welcome.

0 Kudos
Highlighted
New Contributor III
11 Views

Hi Steve,

many thanks for the very fast update. :-)

I tested the new version (exchanged prism.css and prism.js), but unfortunately line numbering seems not to to work on my computer (IE11 or FF49 on Win7 x64, no script blocker). The additional code lines within prism.js imply that it should work. Are there any additional settings necessary or do I have to update more files?

Best regards, Johannes

0 Kudos
Highlighted
11 Views

No - simply adding the plugin to the js is not sufficient - the HTML needs to have the line-number class added to any pre tags. I stuck it in there as I gave this version to our doc people in case they wanted to use it, but I'm guessing that they won't as line numbers would just clutter most of the examples and reduce available width.

0 Kudos