Skip to content

Typst 'asis' output #9163

Answered by cderv
baptiste asked this question in Q&A
Mar 22, 2024 · 3 comments · 23 replies
Discussion options

You must be logged in to vote

knitr has a function to emit raw block - you should use it.

out <- knitr::raw_block(glue::glue("#strong(  [{ spec }] )"), "typst")

Also in ```{yamltypst, echo=FALSE, asis=TRUE} , the asis option is not a known knitr options.

You already used options[["results"]] <- "asis" in your engine, so it should be enough.

Hope it helps

---
title: "Test"
format: 
  typst:
    keep-typ: true
    keep-md: true
---

```{r, echo=FALSE}
library(glue)
library(yaml)
library(knitr)

knitr::knit_engines$set(yamltypst = function(options) {

    options[["results"]] <- "asis"

    # get code together
    code <- paste(options$code, collapse = '\n')

    # parse
    spec <- yaml::yaml.load(code)
    
    # reset…

Replies: 3 comments 23 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
20 replies
@baptiste
Comment options

@cscheid
Comment options

@baptiste
Comment options

@baptiste
Comment options

@cderv
Comment options

Answer selected by baptiste
Comment options

You must be logged in to vote
3 replies
@cderv
Comment options

@baptiste
Comment options

@cderv
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
5 participants