Does quarto support hash pipes with raw typst code blocks like for R and Python? #13766
-
DescriptionHi, I would like to reference a table created by a typst code block. With python I can do this: ```{python}
#| label: tbl-particulars
#| tbl-cap: "Vessel Table"
from tabulate import tabulate
display(Markdown(tabulate(vessel_table.to_pandas().values.tolist())))
```but the same can't be done for typst: ```{=typst}
#| label: tbl-particulars
#| tbl-cap: "Vessel Table"
//some typst code generating a table
```I am on Windows OS 10 Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
This comment was marked as off-topic.
This comment was marked as off-topic.
-
|
@asiddiqi16 to ensure anyone can help, please make sure what your provide can be used. For example, your code don't work and cannot be used as there are missing pieces/context. This being said, comment-pipe options are for code cells. Code cells are contents that are processed very early in Quarto processing and it is done by the engines (knitr, Jupyter, Julia). For cross-reference to work with code celles, there is a requirement: the code should not emit complex structure and should only emit the raw table (no captions, no cross-reference label, etc.) For example, you can also use cross-reference div syntax: ---
title: Issue 13766
format: typst
---
:::: {#tbl-example}
```{=typst}
#table(
columns: 3,
[Header 1], [Header 2], [Header 3],
[Row 1, Col 1], [Row 1, Col 2], [Row 1, Col 3],
[Row 2, Col 1], [Row 2, Col 2], [Row 2, Col 3],
)
```
An example of cross-reference table using raw code.
:::
Note that Quarto has the ability to convert raw HTML tables into the AST (representation of a document) which is used to allow the table to be properly translated into the target format. Hope this helps. If you need further assistance and in the future, please do provide complete document as shown in my various comments and in the guides provided one you open a new Discussion/Issue. |
Beta Was this translation helpful? Give feedback.
@asiddiqi16 to ensure anyone can help, please make sure what your provide can be used. For example, your code don't work and cannot be used as there are missing pieces/context.
This being said, comment-pipe options are for code cells. Code cells are contents that are processed very early in Quarto processing and it is done by the engines (knitr, Jupyter, Julia).
Raw blocks are not evaluated by anything until the end. It's a convenience syntax to allow user to provide code matching the output format that should not be processed in anyway by Quarto.
For cross-reference to work with code celles, there is a requirement: the code should not emit complex structure and should only emit the raw t…