Add support for code highlighting in code blocks
I just added highlighting support for code blocks. It supports the following languages:
- css
- clike
- javascript
- c
- csharp
- cpp
- coffeescript
- fsharp
- go
- haskell
- markup
- java
- json
- latex
- lua
- makefile
- markdown
- matlab
- nix
- pascal
- php
- python
- sass
- scss
- scala
- scheme
- smalltalk
To enable code highlighting, adding the language identifier next to the back ticks:
```java public class Factorial { public static void main(String[] args) { final int NUM_FACTS = 100; for(int i = 0; i < NUM_FACTS; i++) System.out.println( i + "! is " + factorial(i)); } public static int factorial(int n) { int result = 1; for(int i = 2; i <= n; i++) result *= i; return result; } } ```
public class Factorial { public static void main(String[] args) { final int NUM_FACTS = 100; for(int i = 0; i < NUM_FACTS; i++) System.out.println( i + "! is " + factorial(i)); } public static int factorial(int n) { int result = 1; for(int i = 2; i <= n; i++) result *= i; return result; } }
Python:
import urllib2 import re #connect to a URL website = urllib2.urlopen(url) #read html code html = website.read() #use re.findall to get all the links links = re.findall('"((http|ftp)s?://.*?)"', html) print links
Html:
Submitted by Elmer van Chastelet on 14 February 2017 at 14:01<div class="code"> <code> "Some markup code" </code> </div>