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

determine file type of a file without extension

I want to use pygmentize to highlight some script files (python/bash/...) without extension. But pygmentize requires me to specify the lexer using -l. It does not automatically identify the file type from the content. I have the following options at…
doraemon
  • 2,296
  • 1
  • 17
  • 36
0
votes
1 answer

Printing ansi to windows cmd works in IPython, but not anywhere else. Why?

I'm working on making some of my code cross platform, which means I'm battling windows issues. I'm currently having issues getting colors to display in the terminal. I mostly use pygments to work with colors. When I enter: python -c "import…
Erotemic
  • 4,806
  • 4
  • 39
  • 80
0
votes
1 answer

How to use pygments with readline to colorize the input text according to the tokens?

I want to develop a Python theme which executes Python codes and which colorize the tokens in input() while users typing some text. Recently I have started to learn readline and pygments. I can add keyword tokens to the tab completion. Also i can…
dildeolupbiten
  • 1,314
  • 1
  • 15
  • 27
0
votes
0 answers

Send pygments-highlighted code to Windows clipboard

I am looking for answers that may present alternative methods / modifications related to: My method of sending data to the clipboard The choice of Lexer That may solve the following issue... I aim to be able to send raw python via some process to…
Alexander McFarlane
  • 10,643
  • 9
  • 59
  • 100
0
votes
0 answers

pygments ScssLexer issues warning when scss variables are used

I'm using sphinx with the ScssLexer class pygments.lexers.css.ScssLexer. When I try to include a .. code-block: scss in an .rst file that uses variables, such as: .. code-block:: scss h1 { color: $blue; } I get the following…
fulv
  • 1,016
  • 1
  • 9
  • 18
0
votes
1 answer

Associate additional extension with existing lexer

Is there an easy way to add a filename and/or extension for existing lexer in pygments? I don't want to write or subclass existing one, as the language is the same, but the file has different extension/name. I've tried to hack it and add it to the…
grundic
  • 4,641
  • 3
  • 31
  • 47
0
votes
1 answer

How to change monokai pygments style in qtconsole with jupyter

How does one change monokai pygments style such that errors are printed in lighter colours in jupyter qtconsole when using python? See the attached screenshot and especially notice how the error type (AttributeError) is in darkish red, function…
Marcel Liker
  • 93
  • 1
  • 9
0
votes
1 answer

GeSHI new language

I running a mediawiki and want to use syntax highlighting. I am using the extension https://www.mediawiki.org/wiki/Extension:SyntaxHighlight for that. That works pretty fine. Alas I want to highlight a language that is not part of this extension. So…
Martin
  • 852
  • 7
  • 20
0
votes
1 answer

How can I make it so that when I change a tagged word in tkinter, the color changes back?

I am making a text editor, and I am using Pygments to help with syntax highlighting. When I type a keyword, say for, it changes yellow, good. Well, when I either, type a letter after, say fore, for is still yellow, OR if I backspace, fo or f is…
0
votes
1 answer

tkinter pygment highlighting very slow using pygments even when running once

I am trying to get syntax highlighting working in a text editor I am making, it is now highlighting [a few things improperly, but not important right now] using Pygments and obviously tkinter. The problem is that when I run it, even just once, it is…
0
votes
1 answer

Translating a Pygments regexp to JFlex

I'm trying to build a lexer for Markdown in JFlex; I'm looking at the source for Pygments: For example, this is the rule for horizontal rule: (r'^\s*\n(?:\s*[-*_]){3,}\s*\n', Markdown.Markup) I'm naïvely writing this in my .flex…
0__
  • 66,707
  • 21
  • 171
  • 266
0
votes
1 answer

How do I change the highlight color style of the code in the IPython(Jupyter)?

My question is showed in the following picutre. I want to change the highlight color style of the code region that is specified by the red rectangle in the picutre below. But I dont' know which token I should change style of. My pygment style…
Yantao Xie
  • 12,300
  • 15
  • 49
  • 79
0
votes
2 answers

Variable lexer in jinja2 highlight

My jinja2 template receives a code block which may contain any number of different languages. I would like to pass the correct lexer to the template and render it accordingly using the jinja2-highlight plugin (pygments). I render my template using…
mvdwrd
  • 33
  • 6
0
votes
1 answer

how to highlight syntax using flask-flatpages

I recently built a website using flask, flask-flatpages, and flask-freeze and I am wondering how to highlight syntax when I use block-codes in my markdown files. These are my installed packages: click (6.6) Flask (0.11.1) Flask-FlatPages…
aii
  • 39
  • 8
0
votes
0 answers

How do you change the syntax coloring for code snippets in Jekyll?

I'm using github.io to host a website that's built with Jekyll. I'm having a little trouble customizing my configuration. I don't like the default syntax coloring, so I want to change the coloring scheme. I researched this a bit, and I found some…