Doctests don't appear in REPL help mode

Hi there!
Does anyone know why doctests are not displayed in the REPL help mode?
For instance this works

julia> """
           foo(x)
       
       Compute the foo.
       
       # Example
       ```julia
       foo(0) == 1  # true
       ```
       """
       foo(x) = 1
foo

help?> foo
search: foo floor pointer_from_objref OverflowError RoundFromZero unsafe_copyto! functionloc

  foo(x)


  Compute the foo.

  Example
  ≡≡≡≡≡≡≡≡≡

  foo(0) == 1  # true


But this doesn’t.

julia> """
           bar(x)
       
       Compute the bar.
       
       # Example
       ```jldoctest
       bar(0)
       
       # output
       
       2
       ```
       """
       bar(x) = 2
bar

help?> bar
search: bar baremodule SubArray GlobalRef clipboard BitArray backtrace BitMatrix

  bar(x)


  Compute the bar.

  Example
  ≡≡≡≡≡≡≡≡≡

As you can see the example block shows up empty.

My best guess is that Documenter.jl is not “core Julia” and so a block tagged with jldoctest has no reason to show up, but it is still a bit annoying.

It should show up. It is even recommended (6. at Documentation · The Julia Language).

What Julia version are you using? I tried running both your snippets in 1.8.5 and 1.9.0-rc3, and both examples show up for me in both versions.

Are you using OhMyREPL? I found the same exact issue and realized that it was OhMyREPL that was causing it.

1 Like

let me try without OhMyREPL!

You’re right, that was it!

Feel free to comment on the issue.

1 Like