"

Looking to highlight specific lines in your code chunks in Quarto?

Don’t forget to set echo to true!
Author
Affiliation

Building Stories with Data

Published

September 20, 2022

Today’s QuartoPub aha moment…

The option to display a code chunk output next to the code is exactly what I need for the talk I’m preparing. So I tried to follow the demo and just couldn’t get it to work.

quarto.org/docs/presentations/revealjs/#output-location

The solution? Remember to set echo to true!

#| output-location: column-fragment
#| fig-width: 6
#| fig-height: 4

ggplot(
  palmerpenguins::penguins,
  aes(x = bill_length_mm, y = bill_depth_mm, color = species)
) +
  geom_point() +
  colorblindr::scale_color_OkabeIto()

#| echo: fenced

I’m looking forward to using this feature to do things like this, highlighting the bits of code that have changed to get from the first plot to the second. No more rendering plots separately and matching them up with corresponding code! 🥳

Video

Reuse

Citation

For attribution, please cite this work as:
Thompson, Cara. 2022. “Looking to Highlight Specific Lines in Your Code Chunks in Quarto?” September 20, 2022. https://www.cararthompson.com/posts/2022-09-20-todays-quarto-pub-aha-moment-the/.