JuliaDocs / Documenter.jl

A documentation generator for Julia.
https://documenter.juliadocs.org
MIT License
803 stars 475 forks source link

Document how to modify IOContext parameters in outputs #2207

Open mortenpi opened 1 year ago

mortenpi commented 1 year ago

I.e. number of columns of the REPL output etc. -- would be good to have a short how-to guide for this in the docs. Related issues:

@fredrikekre: in reference to https://github.com/JuliaDocs/Documenter.jl/issues/1450, how do you imagine the user using DisplayAs.(set|with)context in Documenter? Explicitly call it in the at-example/repl block? I.e. something like this?

```@example
f() = collect('a':'z') # hide
f() |> DisplayAs.withcontext(...)
asinghvi17 commented 2 months ago

It would be great to have these as "keyword arguments" to the example/repl blocks as well - as well as maybe some defaults on the page level, settable via @meta. That way there is less of a barrier to entry - and people can easily opt in, versus googling to get to DisplayAs and then installing the package, making sure it's used (and hidden) in every example environment, etc.

mortenpi commented 2 months ago

Yes, they should be keywords. We also got https://github.com/JuliaDocs/IOCapture.jl/pull/26 now, so it should be possible to pass these on pretty easily.

One first step towards all that would be to harmonize the parsing on the at-block arguments. I would like there to be a single function that you pass the "language" attribute string (i.e. @example foo; x = 2, y = 3) and it returns a data structure that has the parsed arguments.