Pre And Code Tags In Github Markdown
Not sure if there is some hidden resource somewhere on their site or blog, but I couldn’t find how to get syntax highlighting with
<code> tags. Here is what I found out.
Pre and Code Tags In Github
Not sure when/where I found that you could use
<code> tags, but I liked the idea. The only problem was syntax highlighting, but recently I decided to inspect their markup to see how they convert they fenced option into HTML. In doing so, I found out what attributes you need.
This method is my favored one thus far. Not buggy and you know what to expect. Here is an example of a huge block of C# code that
ONLY worked with these
<code> tags, all documented methods bugged out.
Documented Markdown For Code
There are 2 documented ways to do code blocks in Github’s markdown.
1.) 4 Space Indent
In my case, this is awkward. Especially when pasting in a block of code.
if(foo==true) alert('yes sir'); else alert('boo scenario');
2.) Fenced code block with `
This is the format I’ve used the most, seems easier than the 4 space indent. You need to start with 3
```language and end the fence with another 3
```. This method has proven to be buggy.