Skip to content

Locke/pygments-dafny

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pygments-dafny

About

This repository contains a Dafny lexer for Pygments. It is motivated to be used in LaTeX with minted for simple programs, but not limited to that.

Requirements

  • Python setuptools

    • on Debian: sudo apt-get install python3-setuptools
  • pygments

    • on Debian: sudo apt-get install python3-pygments
    • alternative: sudo easy_install Pygments

Setup

One-Shot installation via: sudo python3 setup.py install (copies the files).

Development installation via: sudo python3 setup.py develop (links to the files). Uninstall with sudo python3 setup.py develop --uninstall.

Usage on CLI

This repository contains an example file: example.dfy

You can render it directly in your terminal with the Command Line Interface: pygmentize example.dfy You can also render it to an html file: pygmentize -f html -O style=solarized-light,full -l dafny -o example.html example.dfy

Please see Pygments' [https://pygments.org/docs/cmdline/](CLI documentation) for all options.

Usage with minted

  • install the minted package in your latex distribution
    • on Debian: sudo apt-get install texlive-latex-extra

Example usage:

\usepackage{minted}

\newmintinline[dafnyinline]{dafny}{escapeinside=||}

Hello \dafnyinline{b := a[1..]}!

shell escape must be enabled (unless you use the draft mode), e.g. via pdflatex -shell-escape.

Status

Developed on Debian 11 with Pygments 2.7.1 and Dafny 3.3.0.

Coverage of the Dafny language is still incomplete.

This repository will not be actively maintained. Small contibutions / PRs are welcome, larger contibutions / PRs might justify a fork with a note here to archive this repo.

About

Pygments lexer for Dafny

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published