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
Add support for defining Topics sections without topic group headings #393
Conversation
1021c41
to
752e1e3
Compare
@swift-ci please test |
752e1e3
to
4e650e6
Compare
@swift-ci please test |
@@ -189,7 +189,7 @@ enum GeneratedDocumentationTopics { | |||
) | |||
|
|||
let collectionTaskGroups = try AutomaticCuration.topics(for: temporaryCollectionNode, withTrait: nil, context: context) | |||
.map({ AutomaticTaskGroupSection(title: $0.title, references: $0.references, renderPositionPreference: .bottom) }) | |||
.map({ AutomaticTaskGroupSection(title: $0.title!, references: $0.references, renderPositionPreference: .bottom) }) |
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.
Are we confident this will never be nil
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.
Yes, the value here comes from AutomaticCuration.ReferenceGroup.title
which is non-nil.
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.
Sounds good. That isn't really clear to me from the context so a comment to that effect might be nice here.
guard !h3Indices.isEmpty else { | ||
return [] | ||
// An index to support topics that aren't organized in topic groups. | ||
let phantomH3Index = Int.min |
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.
👻
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.
Should we consider just making this -1
? I think that would be more obvious to me that it's an intentional choice when reading the debugger instead of -209319034398
.
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.
🥳
@@ -189,7 +189,7 @@ enum GeneratedDocumentationTopics { | |||
) | |||
|
|||
let collectionTaskGroups = try AutomaticCuration.topics(for: temporaryCollectionNode, withTrait: nil, context: context) | |||
.map({ AutomaticTaskGroupSection(title: $0.title, references: $0.references, renderPositionPreference: .bottom) }) | |||
.map({ AutomaticTaskGroupSection(title: $0.title!, references: $0.references, renderPositionPreference: .bottom) }) |
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.
Sounds good. That isn't really clear to me from the context so a comment to that effect might be nice here.
guard !h3Indices.isEmpty else { | ||
return [] | ||
// An index to support topics that aren't organized in topic groups. | ||
let phantomH3Index = Int.min |
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.
Should we consider just making this -1
? I think that would be more obvious to me that it's an intentional choice when reading the debugger instead of -209319034398
.
9055d29
to
54e5b8f
Compare
@swift-ci please test |
Adds support for defining Topics sections without h3 headings, like so: ```md \## Topics - ``MySymbol`` ``` It's also possible to define subsequent topic groups: ```md \## Topics - ``MySymbol`` \### My topic group - ``Another Symbol`` ``` rdar://97739538
The title of task groups is optional in the Swift model. This commit updates the render JSON schema to reflect that.
54e5b8f
to
181311b
Compare
@swift-ci please test |
Bug/issue #, if applicable: rdar://97739538
Forums post: https://forums.swift.org/t/relaxing-structure-requirements-for-topics-sections/60534
Summary
Adds support for defining Topics sections without h3 headings, like so:
It's also possible to define subsequent topic groups:
Dependencies
Testing
Define a Topics section without topic groups like shown above. Verify that the links still render on the page, with the appropriate topic group headings if they were specified.
Checklist
./bin/test
script and it succeeded