-
Notifications
You must be signed in to change notification settings - Fork 414
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
Autolink improvements #355
Conversation
Conflicts: lib/jazzy/sourcekitten.rb
Conflicts: lib/jazzy/sourcekitten.rb
w00 this looks rad :) |
Siesta docs are live with this now, so you can actually play with it and see how it feels. Here’s a couple of examples that show the various features in action: https://bustoutsolutions.github.io/siesta/api/Structs/Configuration.html |
Yeah, that was my dumb. Try it now. |
Ah, much better! I think we'd want to continue autolinking top-level Objective-C types that aren't backticked though, since the traditional three letter prefix should be enough to disambiguate from referencing a word vs the type. |
Do you think so? The inconsistency of that seems confusing to me — though I do agree that the prefixes providing better uniqueness. Others want to weigh in? |
text.gsub(%r{<code>[ \t]*([^\s]+)[ \t]*</code>}) do | ||
original = Regexp.last_match(0) | ||
raw_name = Regexp.last_match(1) | ||
parts = raw_name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be nice to match Objective-C square bracket syntax too: [RLMRealm defaultRealm]
, +[RLMRealm defaultRealm]
and -[RLMRealm writeCopyToPath:encryptionKey:error:]
.
Freezing the children breaks
|
This autolinking approach no longer links |
Good points — I hadn’t even considered Obj-C support. Mostly because there was none when I started this PR! The PR has its fingers in a lot of places, mostly because of the new parent-children relationship and associated refactoring. Having just dragged two long-running PRs along with many changes made underfoot, I propose breaking the remaining work into two separate pieces: Before merging this PR: fix breakages, finish Swift work
After merging this PR: normalize Obj-C support
Sound good? I’m happy to keep working on it; I just want to get a merge in there sooner this time. |
Ah yes, probably smart to keep this PR from feature creeping. I agree with the 3 items you've listed that need to be done in this PR:
As for the 3 points after this PR, I think it's fine to keep dot syntax for ObjC and that it's unnecessarily complicated to support ObjC type references without backticks, so really it's just supporting ObjC-style references like |
Sounds like an episode of Doctor Who.
Think I’ve fixed the outstanding issues. My generic type handling is pretty hokey / permissive: I just strip out anything in angle braces, with no regard for whether it’s actually a generic type, what’s inside the braces, or even for brace balancing. My code thus autolinks to Will pick up specs, docs & changelog tomorrow. |
Agreed. |
Current README seems too high-level to document this, so I just made notes in changelog. Current practice is not to link to this PR because it’s not an issue, correct? |
Correct. |
Think it’s GTG if CI passes. |
Looking at the specs diff, many of the nice places where autolink previously correctly picked up a link are now lost due to the new requirement that links be explicitly backticked, although many false positives are now addressed. Overall, I consider this PR a major improvement, but one area where it would still be nice to have autolinking without requiring backticks is in "see", like |
Agreed with all that. I do think people would start using the backticks if they become significant, but |
My thoughts exactly. Anyway, 👍 for this PR. Merge at will, captain! |
Another one down! Thanks for the fast turnaround on the questions. |
Hey, you did all the hard work! 👏 |
Autolink improvements
@pcantrell Hello, can you share how you achieved reference for NSObject here https://bustoutsolutions.github.io/siesta/api/Classes/Resource.html#/s:vC6Siesta8Resource10latestDataGSqVS_6Entity ?? I'm generating docs for obj-c framework and wondering how to do the same. Thanks |
This PR allows auto-links to siblings, ancestors, top-level elements, and dot-separated chains starting with any of the above:
It allows a
(...)
for long parameter lists, and per the original implementation, does not link from an element to itself: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:
As with previous changes to the generated docs, I’ll gather any feedback on the implementation first, then update integration specs. And changelog!
Fixes #328.