GithubHelp home page GithubHelp logo

krampygs's Introduction

krampygs

Unleash the power of Kramdown with Pygments and Typogruby in Jekyll.

If you want to know, read why it is such a good idea to use Kramdown with Pygments.

Usage

Add krampygs.rb to your _plugins directory, and the following lines

markdown_ext: foo
markdown: kramdown
pygments: true

to your _config.yml. The bogus foo extension is a workaround to get Jekyll ignore its own Markdown converters and use instead the custom converter provided (which explicitly looks for .md files).

Code in your pages can now be syntax highlighted using the power of Pygments.

For example fenced code

~~~ ruby
print "Hello World"
~~~

Or inline code like this: `\section{foo}`{:.language-latex}

You can also define a global default for a whole site adding

kramdown:
  default_lang: python

to your _config.yml; or, for a single page, by adding something like

{::options coderay_default_lang="fortran" /}

near the top of a page. (No, coderay is not being used, but that was the easiest hack I could find to get the value of the option into Kramdown.)

Github flavor markdown syntax is also supported by adding

kramdown:
  input: GFM

to your _config.yml. For example GFM code

```ruby
print "Hello World"
```

Tested with

  • ruby 2.0.0p247
  • jekyll (1.1.2)
  • kramdown (1.1.0)
  • pygments.rb (0.5.2)
  • typogruby (1.0.15)

Thanks

To Matthias for his initial plugin idea, and his help getting it fixed to work with Jekyll 1.x.

Contributors

krampygs's People

Contributors

nokyotsu avatar randy3k avatar

Stargazers

Will Barnes avatar Jeroen Peeters avatar Weixiang Chen avatar Mao avatar Pavel Kogan avatar Earthson Lu avatar Eric Case avatar Zack Siri avatar Konrad Rudolph avatar Tony Pujals avatar Matthias Vogelgesang avatar

Watchers

 avatar

Forkers

subfuzion itsjonq

krampygs's Issues

Having trouble getting set up.

Hello,

First off, I'm a complete Jekyll newbie so please bear with me!

Your repository seems to solve my problem perfectly, I want to use pygments but still have the ability to use footnotes as well which is great. I also see that you've added GFM support which is also awesome :-)

The steps I've taken so far were to copy krampygs.rb to my _plugins folder, and then to modify my _config.ymlfile to have these settings:

markdown: krampygs
kramdown:
   input: GFM
markdown_ext: foo
pygments: true

I left the input: GFM section in because it was the when I was using kramdown just FYI.

So, which blindingly obvious thing am I missing?! Any help you could give me would be really appreciated!

Thanks.

add license

Thanks for coding this up, Juan! Wondering if you could add a license to it?

How to specify pygmentize style, and full option?

pygmentize -o doc/test.html -O style=native,full somejs.js

does what I want to a .js file, but not to a markdown file containing javascript code blocks. I haven't figured out where or how to do that. But even without that, I'm probably doing something wrong because my code blocks like

~~~ javascript  
var foo = "bar";  
~~~

are coming out uncolored.

Also, if you have any idea how to get kramdown to use pygmentize (for someone who knows no Ruby), I'd love a pointer. Thanks.

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.