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 DocC availability information to all directive pages #704

Merged
merged 2 commits into from
Sep 12, 2023

Conversation

d-ronnqvist
Copy link
Contributor

@d-ronnqvist d-ronnqvist commented Sep 11, 2023

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

Summary

This add an introducedVersion property to DirectiveConvertible so that each directive page shows what version of DocC is the earliest version to support that directive.

Dependencies

None

Testing

Run swift run docc preview Sources/docc/DocCDocumentation.docc and inspect the various directive documentation pages

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

Note that since this is a new protocol requirement it is a source breaking change for anyone who has defined their own directives. I could add a default value to mitigate this but my concern is that if new directives don't need to specify when they were introduced, we will forget to add it and the documentation will show the wrong version.

),
SymbolGraph.Symbol.Availability.mixinKey: SymbolGraph.Symbol.Availability(availability: [
.init(
domain: .init(rawValue: "Swift-DocC"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice! Did you consider using "Swift" instead of "Swift-DocC" here? My mental model is that we don't actually have releases of Swift-DocC – Swift-DocC is just included in releases of Swift.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did consider it and I can change it if you prefer.

The only thing I wanted to avoid was someone misunderstanding "Swift 5.9+" and thinking that they can't use it because their package tools version is 5.8. It only matters what toolchain they have, but I'm not sure how to best convey that.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah right. Great point. This reminds of a discussion on the forums I saw recently – we don't currently have a way to indicate "this API was introduced in Swift 5.9 but is back-ported to Swift 5.6 and so as long as you build with Swift 5.9, you can target version Swift 5.6 and use this symbol."

I think it makes since to use "Swift-DocC" at least until we solve that problem. Thanks!

@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

@@ -26,6 +26,7 @@ import Markdown
/// }
/// ```
public final class DisplayName: Semantic, AutomaticDirectiveConvertible {
public static let introducedVersion = "5.6"
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm having trouble confirming but I think this might have been 5.7?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It looks like you're right. I was only looking at when each version was released but this doesn't seem to be on the 5.6 branch.

@@ -28,6 +28,7 @@ import Markdown
/// }
/// ```
public final class PageColor: Semantic, AutomaticDirectiveConvertible {
public static let introducedVersion = "5.8"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public static let introducedVersion = "5.8"
public static let introducedVersion = "5.9"

@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

@d-ronnqvist d-ronnqvist merged commit 4bc2659 into apple:main Sep 12, 2023
2 checks passed
@d-ronnqvist d-ronnqvist deleted the document-directive-availability branch September 12, 2023 16:05
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.

None yet

2 participants