Skip to content
Discussion options

You must be logged in to vote

What's happening here is that Pandoc doesn't like <a> elements to be directly inside divs, and so it inserts a paragraph. This is happening because your output (use keep-md: true to inspect it) doesn't bracket the content in a raw block:

---
keep-md: true
---


<div>
  <a>Some link</a>
</div>

If you need your HTML output to be unprocessed by Pandoc, you need to emit a raw block. I don't know the htmltools syntax to do it, but knitr::raw_html will take a string as input and produce a raw block.

---
keep-md: true
---

```{r}
#| echo: false
#| output: asis

knitr::raw_html(
htmltools::div(
  htmltools::a('Some link')
) |> as.character() |> paste())
```

produces

---
keep-md: true
---


::: …

Replies: 3 comments 9 replies

Comment options

You must be logged in to vote
4 replies
@AlbertRapp
Comment options

@mcanouil
Comment options

@AlbertRapp
Comment options

@mcanouil
Comment options

Comment options

You must be logged in to vote
3 replies
@cscheid
Comment options

@AlbertRapp
Comment options

@cderv
Comment options

Answer selected by AlbertRapp
Comment options

You must be logged in to vote
2 replies
@AlbertRapp
Comment options

@cderv
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants