Figures in a module chapter now survive being staged into a manual.
A module chapter is rendered from wherever the document lives: its own directory when the module renders alone, and the book root once prepManualRmds() has staged it into a manual. Its figures did not move with it, and modules worked around that with normPath(), which bakes in the path of the machine that built the book. That renders locally and then publishes dead links — the LandR manual has been serving src="/home/runner/work/.../figures/..." from every module chapter, unresolvable for every reader, with the build green throughout.
stageFigure()returns a path that works in both cases: unchanged when the module renders alone, and when the chapter is staged, the figure is copied into a directory of the module's own beside the chapter, with the relative path to that copy returned. Per module, because modules reuse conventional names — every one writesfigures/moduleVersionBadge.png, and a shared directory showed each chapter the badge of whichever module was knitted last. Use it where a chunk builds markdown by hand, such as a linked badge.includeFigure()is the chunk form, forknitr::include_graphics(). Passing a staged path toinclude_graphics()directly cannot work: it checks the file against the working directory — the module's — while the staged path is relative to the book root.prepManualRmds()copies the images a chapter references in prose in beside the staged chapter and rewrites the references, and turns caching off for any chunk that stages a figure. knitr serves a cached chunk's output without re-running its code, so the copy was skipped and, from the second build on, the chapter referenced a file that was never staged.
Verified by rendering a two-module book to HTML and PDF twice, the second build on a warm cache, checking each published image against its source.