Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow named @ref to docstrings without backticks #781

Closed
jebej opened this issue Aug 8, 2018 · 3 comments · Fixed by #1900
Closed

Allow named @ref to docstrings without backticks #781

jebej opened this issue Aug 8, 2018 · 3 comments · Fixed by #1900

Comments

@jebej
Copy link
Contributor

jebej commented Aug 8, 2018

You might sometimes want to link to a function without explicitly writing the function name. Currently, writing [some function](@ref somefunction) for a function named somefunction does not work.

@mbauman
Copy link
Contributor

mbauman commented Oct 1, 2019

Bump!

Oh, how I would love to be able to do this. There are many times I really want to use better prose but attach a cross-link to a docstring. Is there really no [](@ref foo) syntax that can do this?

@mortenpi
Copy link
Member

mortenpi commented Oct 1, 2019

What works is [`this is foo`](@ref foo), where you can have an arbitrary string in the backticks. But it is weird that it would only work with backticks, so I agree that it would be great to generalize this.

The only issue I see is how would one distinguish the custom heading IDs from function references. But we could prioritize one over the other I guess -- first see if there is a header ID like that and, if not, look for a docstring.

So the algorithm could be

  • If ref is a string (i.e. surrounded by "), treat it as a heading reference: [...](@ref "Header String")
  • Check if the ref is a custom header ID: [...](@ref header-id)
  • Check if the ref is a docstring: [...](@ref foo(::Int))

Could be a good hacktoberfest issue 😉

mbauman added a commit to JuliaLang/julia that referenced this issue Oct 8, 2019
* Better documentation and docs search for punctuation

* Update doc/src/base/punctuation.md

Co-Authored-By: James Bradbury <[email protected]>

* Update doc/src/base/punctuation.md

Co-Authored-By: James Bradbury <[email protected]>

* Fixup crosslinks

working around JuliaDocs/Documenter.jl#781
@mateuszbaran
Copy link

Bump. I just had exactly this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants