Universe

Unofficial bindings from typst/hypher to native Typst.

Full documentation here.

Versions

hy-dro-gen hypher
0.1.0 0.1.5
0.1.1 0.1.6
0.1.2 (latest) 0.1.6 forked to 83aa0d2

Basic usage

#import "@preview/hy-dro-gen:0.1.2" as hy

// `exists` checks if a language is supported
#assert(hy.exists("fr"))
#assert(not hy.exists("xz"))

// `syllables` splits words according to the language provided (default "en")
#assert.eq(hy.syllables("hydrogen"), ("hy", "dro", "gen"))
#assert.eq(hy.syllables("hydrogène", lang: "fr"), ("hy", "dro", "gène"))
#assert.eq(hy.syllables("υδρογόνο", lang: "el"), ("υ", "δρο", "γό", "νο"))

// Use the following to add hyphenation to a language not natively supported
#let trie_ro = hy.trie(
  // Download patterns from github.com:hyphenation/tex-hyphen
  // (look for files 'hyph-{iso}.tex')
  tex: read("patterns/hyph-ro.tex"),
  // (left,right)-hyphenmin on www.hyphenation.org
  bounds: (2, 3),
)
#hy.load-patterns(
  ro: trie_ro,
)
#show: hy.apply-patterns("ro")