Questions tagged [pygments]

A generic source code syntax highlighter written in Python.

Pygments is a generic source code syntax highlighter, written in , with support for a wide range of common languages and markup formats. Pygments is the standard syntax highlighter used by the Jekyll blogging platform.

264 questions
1
vote
1 answer

Jekyll offsetting initial line of code snippet highlighting

So I'm setting up code highlighting on my blog using Jekyll and Pygments, and the first line of every snippet is offset by some infinitesimal amount. I'm trying to use a right-border of the lineno class to create a gutter, which is making the offset…
oflannabhra
  • 661
  • 5
  • 18
1
vote
1 answer

Pygments style not found

I have created a pygments style, which uses the same colors as xcode, and named it xcode.py: from pygments.style import Style from pygments.token import Keyword, Name, Comment, String, Error, \ Number, Operator, Generic class…
ruben1691
  • 353
  • 3
  • 20
1
vote
1 answer

Set Default Language on Pygments.rb | Redcarpet

I'm trying to set a fix language for Pygments.rb, Javascript. I'm using Redcarpet for the Markdown. So far i'm here: # Model.rb before_save :render_source def render_source require 'redcarpet' renderer = PygmentizeHTMLSOURCE extensions =…
1
vote
1 answer

Code syntax highlighting in my Rails 4.0.4 app using Redcarpet & Pygments.rb?

The objective I am trying to render markdown documentation with snippets of code in it, and I'd like to highlight the syntax like on Github or BitBucket. My Environment Rails 4.0.4 Ruby 2.1.1 In my gemfile gem 'haml-rails' gem 'redcarpet' #…
zabumba
  • 12,172
  • 16
  • 72
  • 129
1
vote
1 answer

Syntax highlighting in Markdown, but line numbers are selected

I am using Markdown to compose posts for a static blog, generated by Pelican and hosted on Bitbucket. Markdown, processed by Pygments, allows me to turn on automatic line-numbering of my code by placing #!python (or whatever language name I like) at…
brannerchinese
  • 1,909
  • 5
  • 24
  • 40
1
vote
1 answer

jekyll highlight tag breaks markdown syntax

Say I have the following in a jekyll post: {% highlight ruby linenos %} def foo puts 'foo' end {% endhighlight %} ## an h2 The highlighting works correctly with me using pygments, but I get the literal "## an h2" in my post. All markdown…
Josh Nankin
  • 2,518
  • 4
  • 28
  • 45
1
vote
2 answers

Texments package not working on Ubuntu

I am trying to use the Texments Latex package on Ubuntu to do syntax highlighting. Texments is a wrapper around Pygments. I installed Texments and followed the steps to add the style file to the path. But when I try to compile the .tex file, I get…
user855
  • 19,048
  • 38
  • 98
  • 162
1
vote
2 answers

Source code highlighting with pygments and html output

I am using Pygments as a source highlighter for documenting a C++ project. Both Python 2.7.x and Pygments are their latest versions. I am having trouble getting a highlighted html output for my source code when I run pygments using command…
1
vote
1 answer

Django syntax highlighting causing character escaping issues

I've been working on my own django based blog (like everyone, I know) to sharpen up my python, and I thought added some syntax highlight would be pretty great. I looked at some of the snippets out there and decided to combine a few and write my own…
pivotal
  • 736
  • 6
  • 16
1
vote
1 answer

Preserving whitespace with Pygments

I'm currently writing an application that uses Pygments to perform syntax highlighting. The problem I'm having is any code I process with Pygments has the leading and trailing whitespace in the file removed, and a single line break added to the…
1
vote
1 answer

Pygments pygmentize pass string

I decided to use Pygments for a website I'm working on, but my lack of terminal knowledge is amazing. I want to use pygmentize to highlight syntax in blog posts, but as they are stored in database I can't just pass filename to it. Is there any way I…
user2742648
1
vote
1 answer

C wrapper for pygments

Is it possible to use pygments from a C application? Is there a C library for pygments? I need to use it from a C++ program.
1
vote
1 answer

How to handle error when exit code is zero in bash

I have the following script ~/bin/cat that uses pygmentize to display syntax highlightable files when ever possible if not just regular old cat. #!/bin/bash for var; do pygmentize "$var" 2> /dev/null if [ $? -ne 0 ]; then …
Chris Seymour
  • 83,387
  • 30
  • 160
  • 202
1
vote
1 answer

Pygments style not being applied in Jekyll blog

http://joshhornby.co.uk/2012/11/14/test-test-test.html As you can see from the link the code at the bottom is just yellow. No styling is being applied. I have installed pygments through the terminal and the stylesheets are all there and working. I…
Joshua Hornby
  • 283
  • 2
  • 6
  • 18
1
vote
2 answers

Highlight a bunch of words?

I'm trying to highlight a bunch of words - so I've written a pygments extension. Basically it works, but still not to my satisfaction. Here's a simple idea which should work: highlight words appropriately, and all other text which doesn't match…
Adobe
  • 12,967
  • 10
  • 85
  • 126