Closed ShixiangWang closed 1 year ago
Which versions of the htmltools
, markdown
and commonmark
packages are you using? For me, with the latest of each of those I do see attributes on headings being supported
library(htmltools)
tmp_path <- tempfile(fileext = ".md")
writeLines(c(
"## Hello Markdown {#hello}",
"",
"Just some regular text here."
), tmp_path)
includeMarkdown(tmp_path) |> print(browse = FALSE)
#> <h2 id="hello">Hello Markdown</h2>
#> <p>Just some regular text here.</p>
It's most likely that your version of markdown
is out of date. That package was recently updated to use commonmark
for markdown processing. Previously, I don't think attributes on headings would have worked.
Here are my session details to compare with your current setup.
Hi @gadenbuie , thank you. I will update and try it again.
Fixed. Thanks again.
@ShixiangWang You're welcome! If you run into something similar or are curious about the syntax supported by markdown
(and therefore includeMarkdown()
), the introduction vignette is a great resource.
@gadenbuie Got it!
I want to create a TOC for a markdown used in the shiny. However, the
<id>
is not generated. I followed the markdown grammar to add the<id>
manually not work.You can see that
is rendered as
Not the same as https://www.markdownguide.org/extended-syntax/#heading-ids.
So what should I do to achieve this?
Best,
Shixiang