--- title: "Quarto Annotation" description: R Workshop author: - name: "Katia Bulekova" url: https://www.bu.edu/tech/support/research/ affiliation: Boston University date: "`r Sys.Date()`" editor: visual format: html: code-line-numbers: true code-annotations: hover --- If we want to enable line numbering we need to add to the header a **code-line-numbers** option. ## Annotation Syntax Steps to enable annotations: 1. Each annotated line should be terminated with a commentsymbol `#` followed by a space and then an annotation number enclosed in angle brackets (e.g. `# <2>` ). You may repeat an annotation number if the annotation spans multiple lines. 2. An ordered list that appears immediately after the code cell which includes the contents of each annotation. Each numbered item in the ordered list will correspond to the line(s) of code with the same annotation number. ```{r} #| label: fig-airquality #| fig-cap: Temperature and ozone level. #| warning: false library(ggplot2) # <1> data(airquality) # <2> ggplot(airquality, aes(Temp, Ozone)) + # <3> geom_point() + # <3> geom_smooth(method = "loess" # <3> ) ``` 1. Load ggplot2 library 2. Use the airquality dataset 3. Plot Temp and Ozone variables By default, code annotation text will appear below the code cell. If you add `code-annotations: hover` to the header, the code annotation text will be displayed when the user hovers over the annotation marker If you add `code-annotations: select` to the header, the code annotation text will be displayed when the user clicks on an annotation marker (selecting it). The annotation text can be dismissed by clicking the annotation marker once again.