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

Pygments for Google App Engine Python Doesn't Work

This is my code: from google.appengine.ext import db import pygments from pygments import highlight from pygments.lexers import get_lexer_by_name from pygments.formatters import HtmlFormatter But I get: import pygments ImportError: No module named…
areke
  • 1,093
  • 1
  • 14
  • 23
0
votes
2 answers

Pygments HTML table with line numbers - horizontal scrollbar for the code cell

I'm using Python implementation of Markdown with codehilite and lineos option. It produces a code like this:
1
           …
usr
  • 695
  • 1
  • 5
  • 14
0
votes
1 answer

undefined method `highlight' Python+Pygments

I am using python 2.6.6 and Pygments version 1.4 on RHEL 6 i386 but always get this error message when I try to create a new project in gitlabhq. gem list reveals: pygments.rb (0.2.3), rubypython (0.5.1) among others. After running rails s -e…
Ura
  • 2,173
  • 3
  • 24
  • 41
0
votes
0 answers

why doesn't pygments discover my custom lexer after installation

i've developed and tested a custom pygments lexer, as described here... i then prepared a pyproject.toml file whose contents are as follows: [build-system] requires = ["setuptools"] build-backend = "setuptools.build_meta" [project] name =…
biosbob
  • 185
  • 1
  • 10
0
votes
0 answers

Crossbar and Pygments

We are using crossbar in our product and I saw crossbar requires to have Pygment. Does anyone know why crossbard needs Pygment for? To my understanding pygment is the library for highlighting syntax in multiple languages, so why would crossbar need…
K DAO
  • 517
  • 1
  • 7
  • 12
0
votes
0 answers

Error while executing python diff2htmlcompare

I am not a python expert but I am trying to execute the below script that compares and generate output of diff side by side. https://github.com/wagoodman/diff2HtmlCompare I am using python 3.8. When I execute the below command as given in…
0
votes
0 answers

Change background color of output cell in JupyterLab

I am using pygments to highlight some syntax in a jupyter notebook. Here a minimal code to reproduce the issue: from IPython.display import display, HTML from pygments import highlight from pygments.lexers import SqlLexer from pygments.formatters…
Neo
  • 448
  • 7
  • 18
0
votes
1 answer

Django - create code blocks in html templates

I would like to create a web page that will display data I have in a table inside a code block just the way it is here, even with a copy function. I can already display the data on the page, I just like to have it formatted in a pretty box, maybe…
Steve
  • 1,028
  • 7
  • 25
  • 42
0
votes
0 answers

Syntax highlighting is not working in ViewVC

Seems like i cannot run the colorization on my ViewVC server. In viewvc.conf i got the following option enabled: [options] detect_encoding = 1 enable_syntax_coloration = 1 default_file_view = markup and mime_types_files = mimetypes.conf, …
0
votes
1 answer

No valid lexer class found error when testing custom Pygments lexer

I put together a lexer that should ideally work for psuedocode, but when I test it using python3 -m pygments -x -l ./psuedo.py:PseudoLexer test.pseudo, I keep getting the following error: "no valid PseudoLexer class found in ./psuedo.py". I looked…
Revise
  • 229
  • 4
  • 11
0
votes
1 answer

Why GNU Global doesn't index Pascal files of a project?

I'm trying to index the Pascal files of a project, on Linux (modern Ubuntu). I've followed the instructions, but I'm very confused because of several factors. The procedure I've applied is: $ apt install global exuberant-ctags $ python3 -m pip…
Marcus
  • 5,104
  • 2
  • 28
  • 24
0
votes
2 answers

Use pygments lexer with antl python target

Terence Parr himself says about antlr3: " Unfortunately, it still seems more difficult to build tokenizer with ANTLR than with a traditional lex-like approach". Where as pygments has lexers for almost any language you can think of:…
Naveen
  • 5,910
  • 5
  • 30
  • 38
0
votes
1 answer

Weird background tinge on pygments highlighting in Jekyll blog

I'm trying to use pygments to add syntax highlighting to my Jekyll blog. Now the highlighting works, but it's pitting a weird tint on my code which is best described by looking at the image below. I'm using the Github syntax stylesheet but that's…
David Tuite
  • 22,258
  • 25
  • 106
  • 176
0
votes
1 answer

pygments highlight print in jupyter

I would like to print a string with sql into my jupyter notebook like below This was done manually with pygments, see Here is what I tried so far from pygments import highlight from pygments.lexers import SqlLexer from pygments.formatters import…
PalimPalim
  • 2,892
  • 1
  • 18
  • 40
0
votes
1 answer

Showing the line numbers in
 in Django project using Pygments

I'm using the Pygments package in my Django project. When I try to render the code snippet in my template, it renders the whole data as follows: Template: ... {% pygmentify %}
{{snippet.body}}
{% endpygmentify…
Sadra
  • 167
  • 1
  • 9