Skip to content

Conversation

@d-ronnqvist
Copy link
Contributor

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

Summary

This is another slice of #1366

It adds a helper function to the DocCHTML/MarkdownRenderer to render page breadcrumbs as HTML

Dependencies

None.

Testing

Nothing in particular for this PR. It only adds an internal helper function. See #1366 for how it eventually does get used.

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
Copy link
Contributor Author

@swift-ci please test

@d-ronnqvist d-ronnqvist force-pushed the output-html-breadcrumbs branch from 134fe56 to f3cf42a Compare December 4, 2025 19:04
@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

@mayaepps mayaepps self-requested a review December 4, 2025 19:17
Copy link
Member

@heckj heckj left a comment

Choose a reason for hiding this comment

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

minor wording suggestion, LGTM

Copy link
Contributor

@mayaepps mayaepps 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! Just one question about the behavior for language-specific names.

return switch goal {
case .richness:
if names.count == 1 {
[.text(names.first!.value)]
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we want this behavior if there is only one language-specific name? If there is a language-specific name, even if there is only one, wouldn't we want to go through the logic in the else block that applies a "class" attribute (which I assume is used for formatting)?

Copy link
Contributor Author

@d-ronnqvist d-ronnqvist Dec 5, 2025

Choose a reason for hiding this comment

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

That's a good question that I don't know if I've written down the answer to anywhere.

The idea is that the language specific elements would have classes like "swift-only" or "occ-only" that can be shown or hidden through very small CSS changes. For example, consider this HTML that represents a link to a method with different names in Swift and Objective-C:

<a href=../somemethod(with:and:)/index.html>
  <code class="swift-only">someMethod(with:and:)</code>
  <code class="occ-only">someMethodWithFirst:AndSecond:</code>
</a>

If we add this CSS to the page:

.swift-only {}
.occ-only {
    display: none;
}

the rendered page will only display the Swift title for that link. If we flip the CSS, then the rendered page will only display the Objective-C title for that link.

If the symbol has the same title on both languages, or is only available in a single language,then it's unnecessary to have 2 <code> elements, and the HTML can be simplified to just:

<a href=../somemethod(with:and:)/index.html>
  <code>someMethod(with:and:)</code>
</a>

Co-authored-by: Joseph Heck <j_heck@apple.com>
@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

@d-ronnqvist d-ronnqvist merged commit 9806c58 into swiftlang:main Dec 5, 2025
2 checks passed
@d-ronnqvist d-ronnqvist deleted the output-html-breadcrumbs branch December 5, 2025 08:47
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.

3 participants