Skip to content
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

Merged
merged 2 commits into from Oct 3, 2022

Conversation

franklinsch
Copy link
Member

@franklinsch franklinsch commented Sep 27, 2022

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:

## Topics

- ``MySymbol``

It's also possible to define subsequent topic groups:

## Topics

- ``MySymbol``

### My topic group

- ``Another Symbol``

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

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

@franklinsch
Copy link
Member Author

@swift-ci please test

@franklinsch
Copy link
Member Author

@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) })
Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Contributor

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

Choose a reason for hiding this comment

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

👻

Copy link
Contributor

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.

Copy link
Contributor

@ethan-kusters ethan-kusters left a 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) })
Copy link
Contributor

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

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.

@franklinsch franklinsch force-pushed the taskgroupless-topics branch 2 times, most recently from 9055d29 to 54e5b8f Compare September 27, 2022 14:48
@franklinsch
Copy link
Member Author

@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.
@franklinsch
Copy link
Member Author

@swift-ci please test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants