Why is `&&` highlighted on Github - github

On Github, I realized that &&s are highlighted in this file but not in the other languages such as Java, JavaScript etc in the same repo. Does anyone know what the highlight actually means?
Thanks
Allen

Because it is an ASHX (WebHandler) file. The syntax highlighting on GitHub it language-specific:
What is ASHX:
http://www.c-sharpcorner.com/uploadfile/prathore/what-is-an-ashx-file-handler-or-web-handler/
Another example of GitHub syntax highlighting for ASHX:
https://github.com/JamesDunne/sql.ashx/blob/master/sql.ashx

This is a bug with GitHub Linguist, which is not selecting the right grammar for highlighting. The current grammar is expecting this kind of syntax and is unable to highlight your file.
My guess is we'd need to select a new grammar just for .ashx. If you know a TextMate, Sublime Text, or Atom grammar capable of highlighting correctly .ashx files, please open an issue or pull request at Linguist.

Related

How to get vscode markdown to highlight OCaml code?

I cannot get my OCaml code block highlight in vscode markdown files. The default syntax to specify language is language where you can put the name of the language to get highlighted. I cannot find the documentation for the keywords for OCaml. .ml files do have highlights.
Regarding markdown, adding ml to the backtick fence should be enough, since VSCode uses highlight.js, and this library does list its supported languages.
With VSCode 1.71 (Aug. 2021), you can even specify triple-backtick code blocks with more than just a language identifier in the info string.
See PR 157947: "Allow markdown code blocks to contain data after language id". Released to VSCode insiders today.
(From issue 157793)
You need to install the OCaml Platform extension.

VSCode issues with syntax highlighting for yaml headers in markdown

I have been using VSCode and Pandoc for writing Markdown documents. VSCode recognizes and highlights some YAML header blocks just fine, but not others. I noticed the problem on HTML comments in Markdown.
If I use this style of YAML header (closed with dashes) at the very top of the document, VSCode seems to recognize the end of the block, and move back to normal highlighting mode after the close of the block(see screenshot "scratch1.md" document).
---
title: Best Article Ever
author: Great Writer
---
However, if I use another legal style (closed with ...) which seems to be legal according to the YAML specification, section 2.2 Structures:
---
title: Best Article Ever
author: Great Writer
...
VSCode does not seem to see the YAML block as closed, and so highlighting is messed up for the rest of the document (see screenshot below).
This problem (messed up highlighting) does not occur for either style if they are not at the very top of the document.
At this point, I'm not sure where the problem is and how I might go about changing it. Some pointers in the right direction would be appreciated.
Is it a problem with my understanding of the YAML syntax?
Is it a problem with the YAML language file in VSCode?
Is it a problem with the markdown language file in VSCode (i.e. problem with the embedded YAML)?
Is it something I have to/can correct with some kind of language extension?
etc.
It isn't hugely important to me, but I have a lot of legacy documents like this and if a correction is reasonably straightforward I'd like to try.
Thanks in advance for any help or explanations.
I work on markdown support for VSCode. Yes, right now you have to use --- to terminate your frontmatter.
I've opened https://github.com/Microsoft/vscode/issues/23178 to track support for using ... as a frontmatter terminator. Feel free to submit a PR for this. I've added some notes on what this would involve: https://github.com/Microsoft/vscode/issues/23178#issuecomment-289136137
Update
This should be fixed in VSCode 1.11+
Here was the fixing PR: https://github.com/Microsoft/vscode/pull/23195

Github Syntax Highlighting On Wiki

I've read this page:
https://help.github.com/articles/creating-and-highlighting-code-blocks/
And everywhere else on Github I can do syntax highlighting inside markdown very simply.
However, on my recent project the syntax highlighting has completely given up on Wiki pages, I can't get it work at all. Everywhere I look the only answer seems to be "make sure you specify the language". It seems like no matter how I specify the language the syntax highlighting doesn't work.
Example page:
https://github.com/ClickSimply/Nano-SQL/wiki/3.-Advanced
However, on that exact same project the highlighting is working as expected in the ReadMe
https://github.com/ClickSimply/Nano-SQL
Seriously out of ideas here, any help is appreciated.
Reached out directly to Github support, this is an issue they're currently working to resolve.

Getting github to syntax highlight my files

github automaticall syntax highlights any code files such as those with .c extensions. And there seems plenty of information about controlling highlighting from within 'markdown' or .md files.
But how can I get it to highlight code files that it doesn't know about?
I can't even get the tabbing right - if I say 4-spaces tabs while editing, it goes back to 8-space ones when I've finished.
I don't care what highlighting style it uses even if it's the wrong language; it must be better than the plain text appearance which looks really flat. Oddly, when editing it uses some sort of highlighting, which again disappears when I've finished.
The files aren't in any well-known language so the highlighting won't be perfect; I just want a bit of colour. But I'd rather not change file extensions as that could be confusing.
The tabbing is done through a ?t=4 parameter added to the GitHub url.
But the syntax highlighting (using Rouge on GitHub pages for instance) itself is either:
set in fenced code block (but only for .md markdown pages)
or by changing the file extension (which you don't want)
But how can I get it to highlight code files that it doesn't know about?
Update Feb. 2021 (5 years later)
Nat Friedman (CEO of GitHub) announces it on Twitter:
Another tiny but nice improvement we just shipped to GitHub – syntax highlighting now works on new files without the need to commit first.

Syntax highlighting on GitHub Wiki refuses to work

This is driving me nuts.
Syntax highlighting doesn't work on a single Wiki page in a project on GitHub.
Take this page, for example: https://github.com/oscar-broman/PAWN-Boilerplate/wiki/Built-in-modules
Here's the source for it: https://gist.github.com/3128950
Oh, great, syntax highlighting works even there.
It seems the reason was I put C++ in some places, only c++ is accepted by the Wiki. If one place has the capital C, no highlighting will be done.