如何在Julia文档字符串中获得缩进



我想在Julia文档字符串中包含一个循环,但当我尝试看似显而易见的方法时,缩进不会显示出来。

"""
Function: dave
Arguments
x: first number
y: second number
Returns
interaction_sum: x + y + xy
Examples
#=
for i in 1:5
println(dave(i, i)) # 3, 8, 15, 24, 35
end
=#
"""

然而,当我在函数前面打问号以获取文档时,循环的缩进就不存在了。

Function: dave
Arguments
x: first number
y: second number
Returns 
interaction_sum: x + y + xy
Examples
#=
for i in 1:5
println(dave(i, i)) # 3, 8, 15, 24, 35
end
=#

我在Python中没有这样的问题。我该如何让这些标签显示在Julia中?

有关如何格式化文档字符串的更多详细信息,请阅读文档部分。

julia> """
dave
# Arguments
x: first number
y: second number
# Returns
interaction_sum: x + y + xy
# Examples
```
for i in 1:5
println(dave(i, i)) # 3, 8, 15, 24, 35
end
```
"""
function dave() end
help?> dave
search: dave code_native @code_native readavailable
dave
Arguments
≡≡≡≡≡≡≡≡≡≡≡
x: first number
y: second number
Returns
≡≡≡≡≡≡≡≡≡
interaction_sum: x + y + xy
Examples
≡≡≡≡≡≡≡≡≡≡
for i in 1:5

println(dave(i, i)) # 3, 8, 15, 24, 35

end

最新更新