fixing issue with highlighter -- it was throwing an error for some reason

This commit is contained in:
tomjohnson1492
2016-12-05 22:40:51 -08:00
parent 1963f15a50
commit 0be4165ec8
6 changed files with 79 additions and 94 deletions

View File

@ -39,7 +39,7 @@ A collection is another content type that extends Jekyll beyond the use of pages
Add the following information to your configuration file to declare your collection:
```liquid
```
collections:
tooltips:
output: false
@ -65,8 +65,8 @@ Create pages inside your new tooltips collection (that is, inside the \_tooltips
Here's an example:
{% highlight yaml %}
{% raw %}```liquid
```yaml
{% raw %}
---
id: basketball
product: mydoc
@ -74,8 +74,6 @@ product: mydoc
{{site.data.definitions.basketball}}{% endraw %}
```
{% endhighlight %}
You need to create a separate page for each tooltip you want to deliver.
@ -113,7 +111,7 @@ Change "mydoc" to the product name you used in each of the tooltip files. The te
This code will loop through all pages in the tooltips collection and insert the `id` and `body` into key-value pairs for the JSON code. Here's an example of what that looks like after it's processed by Jekyll in the site build:
```
```json
{
"entries": [
{

View File

@ -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 %}