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

Support autolinking more than top-level declarations #328

Closed
jpsim opened this issue Oct 29, 2015 · 4 comments · Fixed by #355
Closed

Support autolinking more than top-level declarations #328

jpsim opened this issue Oct 29, 2015 · 4 comments · Fixed by #355

Comments

@jpsim
Copy link
Collaborator

jpsim commented Oct 29, 2015

The autolinking introduced in #324 only links top-level declarations. To make autolinking work with declarations deeper than top-level ones, we'd have to only autolink if it's on the same page (IMO).

@pcantrell
Copy link
Collaborator

I’ve been documenting Siesta assuming that it might eventually work as follows:

  • A program element name must match a complete single-backticked block in order to autolink; you’ll never get links inside larger code blocks, or in plain text.
  • If an element contains a dot, it matches a chain of nested elements from the top level down: Class.method(_:foo:)
  • If an element does not contain a dot, then it either matches an element of the same parent, or a top-level element: Class, method(_:foo:).
  • If a parameter list is too annoyingly long to specify, or if you want to mention multiple methods with the same name, then method(...) matches the first method named “method” regardless of parameters.

@pcantrell
Copy link
Collaborator

It’s bugging me enough that I’m getting together a PR for what I described above to see how it plays out.

Lest you all catch up with merging my submissions.

@pcantrell
Copy link
Collaborator

All right, so I have a draft implementation for this. It can auto-link siblings, top-level elements, and dot-separated chains:

screen shot 2015-11-03 at 12 18 19 am

It allows a (...) for long parameter lists, and per the original implementation, does not link from an element to itself:

screen shot 2015-11-03 at 12 18 56 am

It only links single-backticked text — nothing inside code blocks, nothing inside plain text. Here, “Configuration” happens to be the name of a struct in this project, but is used here as a plain English word in a situation where linking to the struct would be downright misleading:

screen shot 2015-11-03 at 12 19 33 am

My implementation relies on code from #289 and #310, so I guess let’s work on getting those merged and then I’ll create a PR for this.

@jpsim
Copy link
Collaborator Author

jpsim commented Nov 3, 2015

That looks good, @pcantrell!

@pigeondotdev pigeondotdev modified the milestone: The Past Nov 22, 2016
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.

3 participants