Display @code_warntype output in docs

Hi!
How would one go about displaying the output of @code_warntype in a Documenter-generated webpage?
From what I can tell, there are two obstacles:

  • @code_warntype prints its output in the REPL instead of returning it (probably easy to overcome)
  • I sometimes encountered a weird error to the tune of “code_warntype not defined” when trying to expand Markdown files. I generate these Markdown files from Literate.jl, so the MWE is a bit tedious but if no one has encountered this error I can try to come up with one

I think this is because @code_warntype is exported by InteractiveUtils, which is loaded by default only in interactive sessions. An explicit using InteractiveUtils somewhere in your code should solve the issue.

2 Likes

Sounds like the solution, thanks!