Skip to content

Ipelet to format source code snippets using Pygments

Notifications You must be signed in to change notification settings

Felerius/ipe-pygments

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

ipe-pygments

Ipelet to format source code snippets in Ipe documents using Pygments.

Motivation

A popular option to format source code in LaTeX documents is the minted package, which uses Pygments internally. Unfortunately, this requires latex to be run with the -shell-escape option, which is currently not possible in Ipe. This ipelet sidesteps this problem by interacting with Pygments directly from within Ipe.

Getting started

Besides Ipe, you will need a Python version with Pygments installed.

Installing

Copy the pygments.lua file to your ipelet directory. Then, in your preferred place, set the following two preference entries:

prefs.pygments = {
    pygmentize = '/path/to/pygmentize',
    python = '/path/to/python',
}

The latter must point to the Python interpreter that has Pygments installed.

Usage

There are three actions provided under Ipelets -> Pygments:

  • Format: formats the text in the selected text object. After this, you will have to run LaTeX to view the result (Ctrl-L/Cmd-L or File -> Run Latex). Running LaTeX from within the ipelet is possible but unfortunately results in a segmentation fault, crashing Ipe entirely.
  • Edit: opens a dialog allowing you to edit both the source code and language for the selected text object.
  • Revert: reverts the content of the selected text object back to just the plain source code.

About

Ipelet to format source code snippets using Pygments

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages