Render an emphatic object to typst

as_typst(x, ..., font_size = 10, font = NA, line_spacing = 0.3)

Arguments

x

emphatic object

...

other arguments passed to as.character.emphatic()

font_size

font size in points. default: 10

font

name of font. Default: NA means to just use the default raw font

line_spacing

line spacing in em units. Default: 0.3

Value

Character string containing typst representation

Examples

hl_diff("hello", "there") |>
  as_typst() |>
  cat()
#> 
#> ```{=typst}
#> #[
#> #set text(size: 10pt, hyphenate: false)
#> #set par(leading: 0.3em)
#> 
#> #[#[`[1] "`]]#text(fill: rgb("#000000"))[#highlight(fill: rgb("#9aff9a"))[` `]]#[#[`he`]]#text(fill: rgb("#000000"))[#highlight(fill: rgb("#97ffff"))[`ll`]]#text(fill: rgb("#000000"))[#highlight(fill: rgb("#ff7f50"))[`o`]]#[#[`"`]]\
#> #[#[`[1] "`]]#text(fill: rgb("#000000"))[#highlight(fill: rgb("#9aff9a"))[`t`]]#[#[`he`]]#text(fill: rgb("#000000"))[#highlight(fill: rgb("#97ffff"))[`re`]]#text(fill: rgb("#000000"))[#highlight(fill: rgb("#ff7f50"))[` `]]#[#[`"`]]
#> ]
#> ```