Skip to content

Displaying code blocks with line numbers and line highlighting.

License

Notifications You must be signed in to change notification settings

hongjr03/typst-zebraw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

typst-zebraw

Zebraw is a lightweight and fast package for displaying code blocks with line numbers in typst, supporting code line highlighting. The term "Zebraw" is a combination of "zebra" and "raw", for the highlighted lines will be displayed in the code block like a zebra lines.

Example

To use, import zebraw package then follow with #show zebraw.with().

#import "@preview/zebraw:0.1.0": *

#show: zebraw.with()

```typ
hi
It's a raw block with line numbers.
```

example1

The line spacing can be adjusted by passing the inset parameter to the zebraw function. The default value is top: 3pt, bottom: 3pt, left: 3pt, right: 3pt.

#show: zebraw.with(inset: (top: 6pt, bottom: 6pt))

```typ
hi
It's a raw block with line numbers.
```

line-spacing

For cases where code line highlighting is needed, you should use #zebraw() function with highlight-lines parameter to specify the line numbers that need to be highlighted, as shown below:

#zebraw(
  highlight-lines: (1, 3),
  ```typ
  It's me,
  hi!
  I'm the problem it's me.
  ```
)

example2

Customize the highlight color by passing the highlight-color parameter to the zebraw function:

#zebraw(
  highlight-lines: (1,),
  highlight-color: blue.lighten(90%),
  ```typ
  I'm so blue!
              -- George III
  ```
)

example3

About

Displaying code blocks with line numbers and line highlighting.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages