When I create cross-references to flextables, either with a target id specified through #| tab.id: <id> or {r, tab.id=<ic>} chunk options, and use in a cross-reference as \@ref(tab:<id>), the knitted HTML creates a proper link with the correct html target/anchor id and the matching id on the table object:
Yes, there have been some changes in bookdown, I think it had some negative impacts with flextable but I'm not sure if that's where it came from. Anyway, I've prepared a fix.
When I create cross-references to flextables, either with a target id specified through
#| tab.id: <id>
or{r, tab.id=<ic>}
chunk options, and use in a cross-reference as\@ref(tab:<id>)
, the knitted HTML creates a proper link with the correct html target/anchor id and the matching id on the table object:but clicking on the first one doesn't jump/scroll to the second one.
Could this be due to the flextable being inside a
#shadow-root
?REPRODUCIBLE EXAMPLE .Rmd
--- output: bookdown::html_document2 ---
```{r}
| tab.id: table1
| tab.cap: "First Table"
cars |> flextable::qflextable() ```
```{r, tab.cap='Second Table', tab.id='table2'} cars |> flextable::qflextable() ```
Link to \@ref(tab:table1)
And link to \@ref(tab:table2)
REPRODUCIBLE EXAMPLE END