Redcarpet and Highlight highlight plug-in configuration detailed

Source: Internet
Author: User
Tags documentation pack

Using Highlight.js
• Download Highlight
Highlight is a specially built for markdown, code highlighting and 26 code styles that support 54 programming languages. Go to the download page and select the language you are using, then click the Download button to download it, and then unzip it and copy the code style files you like in the Highlight.pack.js and style directories to your project.

• Use Highlight

It is usually referenced once on the layout page, for example:

The code is as follows Copy Code

<link rel= "stylesheet" href= "/css/tomorrow-night.css" type= "text/css" media= "screen, projection"/>
<script src= "/js/highlight.pack.js" type= "Text/javascript" ></script>
<script>hljs.inithighlightingonload ();</script>

Note the path of the reference

• code block notation

Specifies the language of the code, in the form of:

The code is as follows Copy Code
"' PHP
$a = ' a ';
echo $a;
```

But previously used rdiscount this interpreter to parse the above code incorrectly, so use the following redcarpet.

Using Redcarpet

• Install Redcarpet

The code is as follows Copy Code

Lch@localhost:luchanghong.github.com $ sudo gem install Redcarpet
Password:
Fetching:redcarpet-2.2.2.gem (100%)
Building native extensions. This is could take a while ...
Successfully installed redcarpet-2.2.2
1 Gem installed
Installing RI documentation for redcarpet-2.2.2 ...
Installing RDOC documentation for redcarpet-2.2.2 ...


• Modify _config.yml

  code is as follows copy code

Markdown: Redcarpet
Redcarpet:
  Extensions: ["No_intra_emphasis", "Fenced_code_blocks", "Autolink", "Tables", " With_toc_data "]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.