Skip to content

Update navigator image references to the correct relative path #925

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
merged 1 commit into from
May 23, 2024

Conversation

d-ronnqvist
Copy link
Contributor

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

Summary

This fixes a bug in the navigator index where pages with custom @PageImage icons would use the wrong relative path to refer to that image within the .doccarchive.

Dependencies

None.

Testing

  • In any project, add an article with a custom page image icon (and add an image to use as the icon). For example:
# Some article

@Metadata {
    @PageImage(purpose: icon, source: "my-icon")
}

An article with a custom page image.
  • Build and preview documentation for the project.
    • The article's item in the navigator should display the custom icon

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 Not applicable

@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

}
let jsonEncoder = RenderJSONEncoder.makeEncoder(
prettyPrint: shouldPrettyPrintOutputJSON,
assetPrefixComponent: bundleIdentifier.split(separator: "/").joined(separator: "-")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This asset prefix parameter configures the encoder to insert the bundle ID in the relative path for all assets.

Copy link
Contributor

@emilyychenn emilyychenn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@d-ronnqvist d-ronnqvist merged commit 2809e81 into swiftlang:main May 23, 2024
@d-ronnqvist d-ronnqvist deleted the custom-navigator-icons branch May 23, 2024 13:24
d-ronnqvist added a commit to d-ronnqvist/swift-docc that referenced this pull request May 23, 2024
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