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

Allow certain directives #641

Merged
merged 16 commits into from Jun 27, 2023
Merged

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

emilyychenn and others added 2 commits June 23, 2023 15:24
@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 apple:main Jun 27, 2023
2 checks passed
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.

None yet

2 participants