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
2
votes
3 answers

Sensible python source line wrapping for printout

I am working on a latex document that will require typesetting significant amounts of python source code. I'm using pygments (the python module, not the online demo) to encapsulate this python in latex, which works well except in the case of long…
Markus
  • 3,447
  • 3
  • 24
  • 26
1
vote
1 answer

Highlight in html issue with Jekyll/Liquid and pygments

I'm using Jekyll with pygments and having an issue using {% highlight %} in .html posts. As you can see here, it is just printing out {% highlight %} yet on my homepage the syntax highlighting works See here: iwasasuperhero. Here is the code for the…
fleeting
  • 123
  • 8
1
vote
1 answer

How to use Pygments.rb on Heroku?

My app uses a gem (pygments.rb) for syntax highlighting which requires access to pygments lib. I cant get it to work on heroku as Python is not part of the rails build pack. Any help/ link on how to link pygments? Thanks P.S. I've looked at…
Nav
  • 1,185
  • 16
  • 23
1
vote
2 answers

Syntax highlighting HTML with links

Is there a tool available which would convert the sources given into HTML with links? By links I mean that every type, class, and method used would point via href to its definition. I haven't managed to make highlight, syntax-highlight, nor pygments…
Viliam
  • 4,404
  • 3
  • 28
  • 30
1
vote
2 answers

Disable stripping of trailing newlines from code blocks

I'm creating an Asciidoctor document with some code blocks. I'm using pygments as syntax highlighter. In the output, trailing empty lines in a code block are removed. Normally that's fine, but in some specific case I want to include an empty line…
wovano
  • 4,543
  • 5
  • 22
  • 49
1
vote
1 answer

How to highlight whole syntax(including every modules's Keywords,class,etc.) of python in text widget in python tkinter

I am creating code editor, I want to highlight every code properly. I have created a code to highlight code and I have created a different function to highlight string and comments but when I type any code from which already contain some color to…
Coder
  • 92
  • 11
1
vote
0 answers

Creating a Python HTML code snippet with pygments/python-markdown/django-markdownx

What is the correct way of creating a HTML code snippet with pygments / python-markdown / django-markdownx? Basically, I am trying to make it look like the code blocks in the official Python documentation:…
PythonSherpa
  • 2,560
  • 3
  • 19
  • 40
1
vote
0 answers

Apply text wrapping in pygments Terminal formatters

I have made a project that displays markdown in the terminal. I have used pygments library in python for rendering formatted output. lexer = MarkdownLexer() formatter = TerminalFormatter() highlighted = highlight(body_markdown, lexer,…
1
vote
1 answer

How to customize Pygments css classes output

How do i change the classes of the Pygments output? for example, this is the output of pygments default:
        import samplemodule
        
        
Quebeh
  • 134
  • 10
1
vote
0 answers

Highlight custom language on MediaWiki page

My goal is add syntax highlighting for a custom language on my wiki page. In order to do that, I installed Pygments and added my own lexer file (mylexer.py). Since I don't want to pull request the lexer and wait for it to be merged, how do I edit…
1
vote
3 answers

ImportError: No module named pygments.styles when attempting to run Pythontex

When I try to run pythontex via my command line((base) Zachs-MacBook-Pro:mat_300 zachmaurus$ pythontex pythontex.tex) the following occurs: Traceback (most recent call last): File "/Library/TeX/texbin/pythontex", line 50, in import…
1
vote
1 answer

Set the html fontsize in `pygmentize`, the command line tool of `pygments`

I'm trying to convert a python file into an html file using pygments via the command line tool pygmentize with the following command: pygmentize -f html -O full -O linenos=1 out_file.html in_file.py Unfortunately, the default fontsize is too small…
NewNewton
  • 1,015
  • 1
  • 10
  • 22
1
vote
2 answers

How to use Dracula theme as a style in Pygments?

I can not understand documents about Pygments Styles, which says: To make the style usable for Pygments, you must either register it as a plugin (see the plugin docs) or ... put it into the file mondrian.py and this file into the pygments.styles…
Hao Liu
  • 115
  • 6
1
vote
4 answers

How can I customize the output from pygments?

If I run a python source file through pygments, it outputs html code whose elements class belong to some CSS file pygments is using. Could the style attributes be included in the outputted html so that I don't have to provide a CSS file?
Geo
  • 93,257
  • 117
  • 344
  • 520
1
vote
0 answers

How to stop Sphinx to use Pygments for code blocks?

pygments translates code blocks into very ugly, semantically invalid markup. For example this rst .. code block:: html ... head of the document ... will be translated into pre wrapped by two divs and will contain…