mlr-org / mlr3book

Online version of Bischl, B., Sonabend, R., Kotthoff, L., & Lang, M. (Eds.). (2024). "Applied Machine Learning Using mlr3 in R". CRC Press.
https://mlr3book.mlr-org.com/
MIT License
254 stars 59 forks source link

Package links are rendered incorrectly in the html version #746

Closed sebffischer closed 1 year ago

sebffischer commented 1 year ago

E.g. in the first chapter, some links are rendered as r mlr3pipelines

RaphaelS1 commented 1 year ago

definitely html only not pdf? also that's very strange because we would've noticed when proofreading, is this a new bug?

jemus42 commented 1 year ago

It looks fine in the PDF version, at least the one linked on the book website currently:

image

But I don't quite understand how that's possible unless the PDF is generated differently than the HTML in terms of which code is executed where and what's available when.

The issue is probably that the first page is generated from index.qmd which doesn't include common/_setup.qmd like other chapters, and that's where the mlr3book package is loaded, and that's where the package-name-as-links are defined.

I tried adding

{{< include common/_setup.qmd >}}

to index.qmd but the problem is the relative paths - setup.qmd in turn contains an include

{{< include ../../common/_utils.qmd >}}

...but that relative path breaks in this context because index.qmd is in a different hierarchy level than all the other chapters.

Anyway the simple solution was to just load mlr3book in a chunk at the top of index.qmd, see #755