c

crudo

@preview

Take slices from raw blocks

v0.1.1
MIT

Package Information

Last Updated
Minimum Typst Version
0.9.0
Categories
textscriptingutility

1. Get the package

Download the package using the TPIX CLI:

tpix get @preview/crudo:0.1.1

2. Import in your Typst file

Add this to your .typ file:

#import "@preview/crudo:0.1.1": *

Version History

0.1.10.9.0
27d9950a9084...
0.1.00.9.0
c634fef8bdf9...

Crudo

Crudo allows conveniently working with raw blocks in terms of individual lines. It allows you to e.g.

  • filter lines by content
  • filter lines by range (slicing)
  • transform lines
  • join multiple raw blocks

While transforming the content, the original parameters specified on the given raw block will be preserved.

Getting Started

The full version of this example can be found in gallery/thumbnail.typ.

From

#let preamble = ```typ
#import "@preview/crudo:0.1.0"

```
#preamble

and

#let example = ````typ
#crudo.r2l(```c
int main() {
  return 0;
}
```)
````
#example

we get

#let full-example = crudo.join(preamble, example)
#full-example

If you execute that, you get

#eval(full-example.text, mode: "markup")

Example

Usage

See the manual for details.