Docstring not rendering underscore

I have a docstring which is quoted in triple "
When I use ?my_fn the help which is shown, is missing SOME underscores, but not all.

I tried masking the underscores with a backslash but that will not be parsed by julia.

Any ideas?

"""
prepare_something!(dfin,treat_as_categorical_variable,independent_vars::Vector{String})

bla bla
"""
function prepare_something!(dfin,treat_as_categorical_variable,independent_vars)
    return 1
end

1 Like

You can stop this happening by putting some spaces before the function:

"""
     prepare_something!(dfin,treat_as_categorical_variable,independent_vars::Vector{String})

bla bla
"""

I think it’s Markdown trying to make things italicized…

The manual quoth:

Always show the signature of a function at the top of the documentation, with a four-space indent so that it is printed as Julia code.

6 Likes

Quickly coming back to this question: the same thing is happening to me, but in the docstring body.

image

Any tip?

Literally 5 min after posting this follow up question I figured it out. I leave it here for newcomers: Just use double backticks.

image

or just quote it with backticks like you did for residue_id?

Yes, you can do that, but in the final visualization (if you’re using Documenter.jl) this will be rendered diferently, like this.