Skip to content

Allow writing doc links to subsections using special characters #262

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

Merged

Conversation

d-ronnqvist
Copy link
Contributor

Bug/issue #, if applicable: rdar://93458581

Summary

This makes two changes related to doc links to subsections (doc links with fragments):

  • Developers can now write links to subsections using characters that aren't allowed in URL fragments without needing to percent escape those characters in the link.
  • Punctuation characters in doc links to subsections are now removed from the resolved topic reference fragment. This means that links to subsections written both with and without punctuation will resolve.

Dependencies

None.

Testing

In a DocC catalog with at least one article or documentation extension file:

  • Add a few headings that contain punctuation characters

  • Write links to those articles as <doc:article-file-name#Heading-name-with-punctuation>
    The doc links to those subsections should resolve both with and without punctuation

  • Add a few headings that contain emoji or other unicode characters

  • Write links to those articles as <doc:article-file-name#emoji-or-other-unicode-character>
    The doc links to those subsections should resolve without needing to percent encode the emoji or unicode characters.

Checklist

Make sure you check off the following items. If they cannot be completed, provide a reason.

  • Added tests
  • Ran the ./bin/test script and it succeeded
  • Updated documentation if necessary

@d-ronnqvist d-ronnqvist requested a review from franklinsch May 24, 2022 18:13
@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

@d-ronnqvist d-ronnqvist merged commit 3433b8c into swiftlang:main May 25, 2022
d-ronnqvist added a commit to d-ronnqvist/swift-docc that referenced this pull request May 25, 2022
…tlang#262)

* Allow writing doc links to subsections using special characters

rdar://93458581

* Rename ValidatedURL initializers to indicate intended use at call site
d-ronnqvist added a commit that referenced this pull request May 25, 2022
#265)

* Allow writing doc links to subsections using special characters

rdar://93458581

* Rename ValidatedURL initializers to indicate intended use at call site
@d-ronnqvist d-ronnqvist deleted the section-links-with-special-characters branch October 25, 2024 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants