How does code integration in docs work?


Was just browsing the TimeSeries.jl docs (which are broken), in which code is integrated and somehow generated by actually running the code and putting both code and outputs inline.

They seem to be using some sort of macro(!?) like (example taken from here):

@setup int-indexing
using MarketData

@repl int-indexing

How does this work? I’m assuming this is what I’ve seen people refer to as “building docs”, but how does this practically work? Is there a package that does this?


Documenter.jl is used by most packages, and Julia itself.




That looks treat, thanks!

Any idea why this would go wrong the way it does in the TimeSeries docs? In the published docs here all examples fail with undefined errors, which seem due to a required package not being loaded, even though the raw docs file on GitHub here looks like it’s doing the right thing in linking @setup and @repl blocks together.


It seems to have been fixed for the docs on the master branch, e.g.


Ah nice so the raw code on GitHub relates to this and is working after all - just wanted to make sure I’m not looking at an incorrect example of Documenter usage!