Turning an svg icon into a clickable link in inline text

Probably a silly question but is there any ways to wrap an svg image using <svg></svg> tags in a markdown-style link []()? The idea would be to make a clickable svg icon using fontawesome::fa() that I can use in inline text or that I could append to text via paste() or glue::glue() for example.

Hi @arangaca,

what about:

---
title: 'Posit 202750'
output: html_document
date: "2025-06-20"
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

## Something like this?

```{r echo=FALSE}
generate_link_with_icon <- function(href, text, name, color) {
  cat(
    '<a href="',
    href,
    '" target="_blank">',
    text,
    fontawesome::fa(name = name, fill = color),
    '</a>'
  )
}
```


```{r results='asis', echo=FALSE}
generate_link_with_icon(href = "https://github.com", "Super nice link text", "github", "black")
```

Output:

image