'Why is table numbering not working with blogdown::html_page, but working with bookdown::html_document2?

I have a report written in R Markdown that is supposed to use numbered sections, figures, and tables and cross-references to them: https://github.com/joshuaborn/NSFG/blob/master/reports/use-of-contraception-in-the-united-states-2017-2019.Rmd

When I render the file to output of bookdown::html_document2 all the numbering and cross-references work fine. However, when I render the file to output blogdown::html_page for my blog, the sections and figures get numbered, but the tables don't. This also breaks all the cross-references to tables in the document.

The blogdown::html_page documentation says that it

is a simple wrapper of bookdown::html_document2() with different default arguments, and more importantly, a special HTML template designed only for blogdown to render R Markdown to HTML pages that can be processed by Hugo.

So I think this might be an issue as simple as different arguments needing to be passed in to blogdown::html_page, but I looked through the documentation and the functions' source code and didn't find anything.

I have a workaround where I render the report to bookdown::html_document2 with caching on, then delete the HTML file, and render it a second time to blogdown::html_page using the cache from the first render. This results in numbered tables with the HTML file in the appropriate format for Hugo. It would be nice to get to the bottom of this to make my build process have less overhead, though.

Edit: I created a minimally reproducible example: https://github.com/joshuaborn/minimal-example

Note that the huxtable tables are numbered and cross-references to it work in when bookdown-article.Rmd is rendered, but not when blogdown-article.Rmd is rendered.

Since this appears to be an issue with huxtable tables in particular, I've added a huxtable tag to this question.

A GitHub issue was created here: https://github.com/hughjonesd/huxtable/issues/225



Solution 1:[1]

This is going to be fixed in huxtable. https://github.com/hughjonesd/huxtable/commit/1a126bf876e4abb12e2949a063e67e53052ca660

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Joshua Born