Giter VIP home page Giter VIP logo

kramdown-with-pygments's Introduction

Kramdown with Pygments

A Jekyll plugin that enables Pygments syntax highlighting for Kramdown-parsed fenced code blocks. Heavily based on krampygs, but refactored to make it work with Jekyll 2.*.

In the standard setup, Jekyll Kramdown only works with Pygments for syntax highlighting when you use Liquid tags. This plugin makes Kramdown also use Pygments when using fenced code blocks. That way you can use more Markdown and less Liquid. Yay!

Usage

  • Clone this project into your _plugins directory.
  • Add the following lines to your _config.yml
markdown: KramdownPygments

Fenced code blocks can now be syntax highlighted using the power of Pygments.

~~~php
print "Hello World"
~~~

The same goes for inline code:

You could also do something like this: `var foo = 'bar'`{:.language-javascript}. Amazing!

Setting the default language

If you don't want to set the language for inline code blocks like that every time, you can define a global default language for the entire site in your _config.yml

kramdown:
  default_lang: php

If you want to override that for a single page, add the following at the top of that page, but below the front-matter

{::options kramdown_default_lang="php" /}

Options

This plugin supports all options that the original kramdown converter supports:

kramdown:
  auto_ids: true
  footnote_nr: 1
  entity_output: as_char
  toc_levels: 1..6
  smart_quotes: lsquo,rsquo,ldquo,rdquo
  input: GFM

Tested with

  • kramdown 1.4.0
  • pygments.rb 0.6.0
  • jekyll 2.1.1
  • ruby 2.0.0p451

Thanks

This plugin is heavily based on krampygs. Thanks to @navarroj for developing the original plugin.

kramdown-with-pygments's People

Contributors

mvdbos avatar meedamian avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.