-
Notifications
You must be signed in to change notification settings - Fork 147
Fix rendering issue for links with special characters #532
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
Fix rendering issue for links with special characters #532
Conversation
@swift-ci please test |
Despite adding a lookup of all resolved references I've not seen any regression in peak memory usage in my local testing
|
@swift-ci please test |
@swift-ci please test |
Hm.. for some reason the CI is failing with errors that I can't reproduce locally with either Swift 5.8 or Swift 5.9 |
@swift-ci please test |
86650ed
to
c20c52e
Compare
@swift-ci please test |
@swift-ci please test |
After the latest changes I still see no measurable performance differences compared to main. |
@@ -639,7 +639,7 @@ private extension CharacterSet { | |||
/// | |||
/// If this step is not performed, the disallowed characters are instead percent escape encoded, which is less readable. | |||
/// For example, a fragment like `"#hello world"` is converted to `"#hello-world"` instead of `"#hello%20world"`. | |||
func urlReadableFragment(_ fragment: String) -> String { | |||
func urlReadableFragment<S: StringProtocol>(_ fragment: S) -> String { |
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.
I don't remember what version of swift we aim to support, would some StringProtocol
be acceptable here?
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.
Not yet, we support Swift 5.5 and the some
keyword was added in Swift 5.7
@swift-ci please test |
* Fast path to look up resolved references by their absolute string rdar://85531439 * Fix bug where links with special characters used the link as title rdar://85531439 * Skip new test when running old link resolver implementation * Add more type annotations in test to accommodate other compiler versions * Expand the fallback parsing of authored documentation links
* Fast path to look up resolved references by their absolute string rdar://85531439 * Fix bug where links with special characters used the link as title rdar://85531439 * Skip new test when running old link resolver implementation * Add more type annotations in test to accommodate other compiler versions * Expand the fallback parsing of authored documentation links
Bug/issue #, if applicable: rdar://85531439
Summary
Fix an issue where symbol links or documentation links containing special characters resolved successfully but didn't render as expected on the page.
There are two parts to this fix:
MarkupReferenceResolver
replaces the links original destination with the absolute string of the resolves reference but the resolved reference replaces non-path characters with "-" resulting in potential ambiguity when re-resolving the link.isAutolink
attribute ofLink
values when updating their destination with a new resolveddestination
Dependencies
None.
Testing
π
or 😃—in an element that can be linked to. This can be either in a symbol name, article file name, or heading.See for example this unit test.
Expected: The link should resolve and render with its title as the link text
Expected: The link should resolve and render with its title as the link text
Checklist
Make sure you check off the following items. If they cannot be completed, provide a reason.
./bin/test
script and it succeeded