Skip to content

Conversation

@emilyychenn
Copy link
Contributor

@emilyychenn emilyychenn commented Jun 23, 2023

Bug/issue #, if applicable: #591

Summary

Allow some directives in doc comments. This feature is motivated by allowing the @Snippet directive in doc comments, as was noted here: https://forums.swift.org/t/using-snippets-in-documentation-comments-not-possible/65046.

Testing

With a documentation catalog

In a documentation catalog with symbol graph files and documentation extension files:

  1. In the documentation extension file for the module symbol: add a few different directives in the comments. For example:
    /// @TabNavigator {
    ///     @Tab("Tab 1") {
    ///         @Row {
    ///             @Column {
    ///                 Hello!
    ///             }
    ///
    ///             @Column {
    ///                 Hello there!
    ///             }
    ///         }
    ///
    ///         Hello there.
    ///     }
    ///
    ///     @Tab("Tab 2") {
    ///         Hey there.
    ///
    ///         @Small {
    ///             Hey but small.
    ///         }
    ///     }
    /// }
    
  2. Preview the documentation for that docc catalog with docc preview /path/to/Example.docc
  3. Navigate to that page in the preview. The added directives should render as expected, and there should be no warnings about unsupported directives.

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

@emilyychenn emilyychenn marked this pull request as ready for review June 23, 2023 19:26
@emilyychenn
Copy link
Contributor Author

@swift-ci please test

@ethan-kusters
Copy link
Contributor

@swift-ci please test

@emilyychenn
Copy link
Contributor Author

@swift-ci please test

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.

Looks great! Thank you!

@ethan-kusters
Copy link
Contributor

@swift-ci please test

@emilyychenn emilyychenn merged commit d2bf7d6 into swiftlang:main Jun 27, 2023
emilyychenn added a commit to emilyychenn/swift-docc that referenced this pull request Jun 27, 2023
Allow certain directives in documentation comments

rdar://111414385
emilyychenn added a commit that referenced this pull request Jun 28, 2023
Allow certain directives in documentation comments

rdar://111414385
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