Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion docs/authoring/code-annotation.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,22 @@ The default HTML annotation style displays annotations in a list below the code
format: revealjs
```

The PDF format also allows for annotations, numbering, and displaying the annotation text below the code. In other formats, like Word and GitHub Markdown, annotations are instead labeled with the line of code (or lines of code) to which the annotation text applies.
The PDF and Typst formats also allow for annotations, numbering, and displaying the annotation text below the code. In other formats, like Word and GitHub Markdown, annotations are instead labeled with the line of code (or lines of code) to which the annotation text applies.

::: panel-tabset
#### PDF

![](images/annote-pdf.png){fig-alt="Screenshot of output in PDF format showing code annotation."}

#### Typst

{{< prerelease-callout 1.11 >}}

In Typst output, each annotation number is a circle at the end of the annotated line, and links to the annotation text below the code block.
The annotation text links back to the line.

![](images/annote-typst.png){fig-alt="Screenshot of output in Typst format showing code annotation: circled numbers 1 and 2 at the end of the annotated lines of an R code block, and the two annotation texts below it."}

#### GitHub Flavored Markdown

````markdown
Expand All @@ -64,6 +73,7 @@ add new columns for the bill ratio and bill area.
To add code annotation to a code block, you need to add two things: specially formatted code comments in your code cell, and an ordered list below the code cell with the annotation text. Read more in [Annotation Syntax](#annotation-syntax).

The `code-annotations` option controls how annotations appear in the HTML format (`below` (default), `hover` or `select`), and in all formats, whether annotation is disabled (`false`), or if annotations should be removed from the output (`none`).
In Typst output, the `hover` and `select` styles use the same layout as `below`.

## Annotation Syntax {#annotation-syntax}

Expand Down
Binary file added docs/authoring/images/annote-typst.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions docs/authoring/markdown-basics.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,8 @@ code
```
````

In HTML and Typst output, the filename shows as a bar above the code block.

If you are creating HTML output there is a wide variety of options available for code block output. See the article on [HTML Code](/docs/output-formats/html-code.qmd) for additional details.

## Raw Content
Expand Down
2 changes: 1 addition & 1 deletion docs/output-formats/html-code.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ plt.plot([1,23,2,4])
plt.show()
```

Non-HTML formats will still have the filename, but it will simply be shown in bold above the code block.
Typst output shows the filename in a bar above the code block. Other non-HTML formats will still have the filename, but it will simply be shown in bold above the code block.

## Highlighting

Expand Down
Loading