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
3
votes
1 answer

Any Pygments lexer for the Mustache templating language?

I'd like to list source code of Mustache templates in my paper, and I'm using the minted package for highlighting code in my LaTeX source. The minted package simply uses Pygments. But there isn't any Pygments lexer for Mustache at the moment. Does…
3
votes
1 answer

"pygmentize: command not found" Even though I already installed pygments on my system

I tried installing pygments on Debian 9 using both apt-get install python3-pygments and pip install Pygments but no method makes it work on the command line. My suspicion is that my PATH doesn't contain the path of the installations. I added…
Laraconda
  • 667
  • 6
  • 15
3
votes
0 answers

LaTeX minted package not working with `\begin{minted}` anymore on win10?

I've been using minted without any problem for years. I'm an Windows 10 and MacOS. Here's a minimal example compiled with xelatex: \documentclass{article} \usepackage{unicode-math} \usepackage{minted} Hi…
UGLi
  • 71
  • 4
3
votes
1 answer

Pygments command line not syntax highlighting HTML output

I am trying to take a python script and prepare it for paper printing with syntax highlighting and line numbering. I have used the following command line instruction: pygmentize -f html -O style=colored,linenos=1 -l python -o .html…
3
votes
1 answer

Filter whitespace and newlines with Pygments

I've been trying to add syntax highlighting to my django site. The problem is I'm getting the   and
characters formatted as well. Is there a way to preserve these characterss? Here is the code I'm using: from BeautifulSoup import…
Ruben Quinones
  • 2,442
  • 8
  • 26
  • 30
3
votes
1 answer

Detect programming language of a snippet using Pygments

I'm using the guess_lexer() method of Pygments library to identify the source code in a snippet: This is how I'm using it right now: from pygments.lexers import guess_lexer text = "string containing source code" lexer_subclass =…
3
votes
0 answers

Use custom pygments syntax highlighting style in rmarkdown

How can I use a custom pygments syntax highlighter in rmarkdown? With pygments I created a file nice.py: from pygments.style import Style from pygments.token import Keyword, Name, Comment, String, Error, \ Number, Operator, Generic class…
needRhelp
  • 2,948
  • 2
  • 24
  • 48
3
votes
1 answer

Python Pygments color error

I've been trying to make a simple text pad with syntax highlighting for python. but the problem is when i open quote a string ad pt the closing quote, the text are the quotes doesn't change back, here's how it looks: here is my current code: from…
Ako Cruz
  • 343
  • 1
  • 2
  • 12
3
votes
1 answer

How to highlight CSHTML in Jekyll/Pygments

I'm using Pygments for highlighting code snippets in Jekyll. I want to know how to highlight .cshtml/.aspx files using Pygments highlighter
Arasu RRK
  • 1,078
  • 16
  • 28
3
votes
1 answer

Python virtualenv picks up wrong library

$ virtualenv --version 13.0.3 I create a new virtualenv with Python3 without access to global site packages. $ virtualenv --no-site-packages venv_pygments --python=/usr/local/bin/python3 Running virtualenv with interpreter…
ustroetz
  • 5,802
  • 16
  • 47
  • 74
3
votes
3 answers

How do I get the css for a pygments formatter?

I'm using pygments in the basic manner from http://pygments.org/docs/quickstart/ My formatter is created like this: formatter = HtmlFormatter(cssclass="codehilite", linenos='table', linenostart = lineno -…
Jason S
  • 184,598
  • 164
  • 608
  • 970
3
votes
2 answers

How to highlight Markdown code in Jekyll?

I want to highlight markdown code in jekyll but I can't find a way how to do it. I looked at Pygement's lexers but I did not found one for markdown or kramdown. I can highlight other codes but not markdown and kramdawn.
mehdix
  • 4,984
  • 1
  • 28
  • 36
3
votes
2 answers

How to install a new lexer in pygments?

I wrote a new lexer for pygments and I try to use it. Thus I look at this page http://pygments.org/docs/lexerdevelopment/ where the install procedure is described. They said to do make mapfiles but I don't know where. I look into this two…
Ger
  • 9,076
  • 10
  • 37
  • 48
3
votes
3 answers

Cannot post Python code to the website rosalind.info

I am trying to post a sample solution, written in Python, to rosalind.info. I tried following their instructions: To highlight code, add a shebang styled first line :::lexername to your code. Replace lexername with the lexer keyword for the…
NickB
  • 1,471
  • 4
  • 14
  • 20
3
votes
1 answer

Redirect python tracebacks through Pygments

My application is invoked from run.py. I've installed Pygments and I'd like to redirect Python's output so that as tracebacks occur, they're formatted in an easier to read format. This is the command that I've tried, python run.py 2>&1 | pygmentize…
skyler
  • 8,010
  • 15
  • 46
  • 69