This issue is based on the discussion in https://github.com/quarto-dev/quarto-cli/discussions/3717. Just reporting here so it's easier to follow.

It would be nice if Quarto supported ANSI colour output with `downlit`.  Currently Quarto uses downlit for code linking when `code-link: true`, but this doesn't make colours work.

I thought it would work based on my experiences with `pkgdown`, but after some discussion it sounds like `pkgdown` does some additional  processing with `fansi` to support colour output (See https://github.com/quarto-dev/quarto-cli/discussions/3717#discussioncomment-4459352). At this time, if you do need colour output in Quarto, you can get it use the `fansi` knitr hooks for converting ANSI highlighting to HTML highlighting. See https://github.com/quarto-dev/quarto-cli/discussions/3717#discussioncomment-4459352.

One thing that is nice about this approach with `fansi` is that you can turn the hook on and off throughout a document, in case you only want colour output for certain parts. For example, in [this blog post](https://tidytales.ca/posts/2022-12-20_palettes/) I have `fansi` hooks on in the body of the post, but turned them off for the [appendix](https://tidytales.ca/posts/2022-12-20_palettes/#session-info) so the output from `sessioninfo::session_info()` wouldn't be coloured.

If Quarto does support colour output in the future, it would be nice to make it a chunk option (e.g., `colour-output: true/false`) rather than a document-wide option like `code-link` so it can be used selectively when needed.
___

Here's a reprex copied from the discussion that can be used for testing.

````
---
title: "Reprex"
format:
  html:
    code-link: true
---

```{r}
#| collapse = TRUE
cat(cli::col_red("This is red"), "\n")
cat(cli::col_blue("This is blue"), "\n")

message(cli::col_green("This is green"))

warning(cli::style_bold("This is bold"))
```
````
cderv
2022-12-22T01:04:10Z
mccarthy-m-g
enhancement
Future
open
Support ANSI colour output with `downlit`
https://github.com/quarto-dev/quarto-cli/issues/3730