Skip to content

Cj-bc/ob-typst

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ob-typst – Org babel file for typst

Org babel for typst. It can generate image or pdf, and inserts link to them.

If you are not familiar with org-babel, links below might be useful.

Installation

Along with this package, you also need typst/typst cli command

(leaf ob-typst
  :el-get Cj-bc/ob-typst)

Basic usage

Write typst in code block

#set text(fill: white, size: 25pt)

 = Hello!
 This is sample typst snippet with formula $y = x^2 + 2x + 3$.

Calling C-c C-c (org-ctrl-c-ctrl-c) on it converts it into image, saves to temporary file, and inserts link to it.

If you are using png or svg, you can press C-c C-x C-v (org-toggle-inline-images) to preview image in the buffer.

./images/result-inserted-example.png

./images/result-preview-example.png

Features

Output to specified file

You can specify file name for the generated image/pdf by :outfile argument:

= Hello Sample file!

This file should be at _images/sample.png_

images/sample.png

Default rules for unspecified rules

You can define default page rule (defines page size, etc) ob-typst/default-rules-alist that will be automatically inserted when no relevant rule is written in the snippet.

By default, It sets page rule and width and height are auto so that it won’t be too big.

#set page(width: auto, height: auto, margin: 0.3em)

Customize

ob-typst/default-format

It defines default file format to use when :outfile is not specified.

ob-typst/default-rules-alist

It defines default rules for settable elements.

About

org babel for typst

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published