Newbie questions concerning Documenter.jl usage: @example & link to source code


#1

I trying to document some Julia code and I am struggling with these two problems:

Question 1:

Is it possible to use @example direclty in my code.jl Julia source code files: ?

"""
          foo()

 Some doc

 ```@example
   a = 1
 ```
"""
foo() = ...

-> when I do that a = 1 is verbatim copied in my html page but not executed (no result in the html page)

Note that when I define the @example in my index.md it works properly -> code is executed and both code and result are shown in the generated html page.

Please also note that jldoctest is working as expected, both in source code.jl file and index.md file

So my question is: is it possible to define @example code blocks directly in the Julia source code documentation (I expect these blocks to be executed and their results to be shown in the html pages) ?

Question 2:

In the official Julia documentation there is a source link directly pointing to the documented item source code (the .jl files). What is the setup to reproduce that?

thanks!