The books you linked are made using bookdown::bs4_book()
format, which indeed have integrated the feature of using downlit to do the linking.
This is mentioned in the doc 3.1 HTML | bookdown: Authoring Books and Technical Documents with R Markdown
- R syntax highlighting and autolinking by the downlit package is paired with an accessible color scheme designed by Alison Hill.