fixing issue with highlighter -- it was throwing an error for some reason
This commit is contained in:
@ -13,66 +13,41 @@ folder: mydoc
|
||||
For syntax highlighting, use fenced code blocks optionally followed by the language syntax you want:
|
||||
|
||||
<pre>
|
||||
```ruby
|
||||
def foo
|
||||
puts 'foo'
|
||||
end
|
||||
```java
|
||||
import java.util.Scanner;
|
||||
|
||||
public class ScannerAndKeyboard
|
||||
{
|
||||
|
||||
public static void main(String[] args)
|
||||
{ Scanner s = new Scanner(System.in);
|
||||
System.out.print( "Enter your name: " );
|
||||
String name = s.nextLine();
|
||||
System.out.println( "Hello " + name + "!" );
|
||||
}
|
||||
}
|
||||
```
|
||||
</pre>
|
||||
|
||||
This looks as follows:
|
||||
|
||||
```ruby
|
||||
def foo
|
||||
puts 'foo'
|
||||
end
|
||||
```java
|
||||
import java.util.Scanner;
|
||||
|
||||
public class ScannerAndKeyboard
|
||||
{
|
||||
|
||||
public static void main(String[] args)
|
||||
{ Scanner s = new Scanner(System.in);
|
||||
System.out.print( "Enter your name: " );
|
||||
String name = s.nextLine();
|
||||
System.out.println( "Hello " + name + "!" );
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Fenced code blocks require a blank line before and after.
|
||||
|
||||
If you're using an HTML file, you can also use the `highlight` command with Liquid markup:
|
||||
|
||||
{% raw %}
|
||||
<pre>
|
||||
{% highlight ruby %}
|
||||
def foo
|
||||
puts 'foo'
|
||||
end
|
||||
{% endhighlight %}
|
||||
</pre>
|
||||
{% endraw %}
|
||||
|
||||
It renders the same:
|
||||
|
||||
{% highlight ruby %}
|
||||
def foo
|
||||
puts 'foo'
|
||||
end
|
||||
{% endhighlight %}
|
||||
|
||||
|
||||
The theme has syntax highlighting specified in the configuration file as follows:
|
||||
|
||||
```
|
||||
highlighter: rouge
|
||||
```
|
||||
|
||||
The syntax highlighting is done via the css/syntax.css file.
|
||||
|
||||
## Available lexers
|
||||
|
||||
The keywords you must add to specify the highlighting (in the previous example, `ruby`) are called "lexers." You can search for "lexers." Here are some common ones I use:
|
||||
|
||||
* js
|
||||
* html
|
||||
* yaml
|
||||
* css
|
||||
* json
|
||||
* php
|
||||
* java
|
||||
* cpp
|
||||
* dotnet
|
||||
* xml
|
||||
* http
|
||||
If you're using an HTML file, you can also use the `highlight` command with Liquid markup.
|
||||
|
||||
{% include links.html %}
|
||||
|
Reference in New Issue
Block a user