Extracting Documenter.jl examples for precompilation

Is there any method to go through all @example blocks in the documentation of a package, extract self-contained scripts that were written by the author, and then use these scripts for precompilation of the package?

I am trying to avoid code repetition, and since I am already writing docs for the most common use cases of the package, I would like to take these use cases and precompile during package installation.

Anyone has thoughts or a proof of concept for this?

cc: @mortenpi @fredrikekre

3 Likes

I don’t think so.

My first reaction is that this would become a very heavy precompile load though. Likely it is better to identify what needs precompiling and target that more surgically.

We have named examples with Documenter.jl, so we could select just those with a given name:

```@example precompile
...

Can we extract all these named examples somehow and place into a big script for precompilation?