c

codedis

@preview

A simple package for displaying code.

v0.3.0
MIT

Package Information

Last Updated
Categories
components

1. Get the package

Download the package using the TPIX CLI:

tpix get @preview/codedis:0.3.0

2. Import in your Typst file

Add this to your .typ file:

#import "@preview/codedis:0.3.0": *

Version History

0.3.0
cef0b85c2140...
0.2.0
109714a092ea...
0.1.0
7f04f05b6a0d...

CODEDIS - Simple CODE DISplay for Typst

Used to display code files in Typst. Main feature is that it displays code
blocks over multiple pages in a way that implies the code block continues onto
the next page. Also a simple and intuitive syntax for displaying code blocks.

Example usage:

// IMPORT PACKAGE
#import "@preview/codedis:0.3.0": code

// READ IN CODE
#let codeblock-1 = read("some_code.py")
#let codeblock-2 = read("some_long_code.cpp")

#set page(numbering:"1")
#v(80%)

// DEFAULT LANGUAGE IS Python ("py")
#code(codeblock-1)
#code(codeblock-2, lang:"cpp", line-numbers: true, lines:(37, 45))

Renders to:

image