Skip to content

add experimental Doxygen support #497

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

Merged
merged 4 commits into from
Mar 3, 2023

Conversation

QuietMisdreavus
Copy link
Contributor

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

Summary

This PR takes the Doxygen support added to Swift-Markdown in swiftlang/swift-markdown#107 and adds it to Swift-DocC behind an experimental flag. By passing --experimental-parse-doxygen-commands to docc convert or docc preview, \param and \returns commands will be handled as if they were - Parameter and - Returns list items. This allows users transitioning from a different documentation system that handles Doxygen or HeaderDoc commands to transition to Swift-DocC without needing to change these commands immediately.

Dependencies

None (the Swift-Markdown PR is already merged and is being used in this PR)

Testing

Steps:

  1. Add the symbol graph from Tests/SwiftDocCTests/Test Resources/DeckKit-Objective-C.symbols.json to a documentation catalog.
  2. swift run docc preview MyDocs.docc --experimental-parse-doxygen-commands
  3. Ensure that the page for [PlayingCard newWithRank:ofSuit:] correctly displays "Parameters" and "Return Value" sections instead of the raw \param and \returns command lines.

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

@QuietMisdreavus
Copy link
Contributor Author

@swift-ci Please test

@@ -35,6 +35,7 @@ public struct ConvertAction: Action, RecreatingContext {
let inheritDocs: Bool
let treatWarningsAsErrors: Bool
let experimentalEnableCustomTemplates: Bool
let experimentalParseDoxygenCommands: Bool
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think the changes in this file are needed since we're using the global Features.current for all the checks. experimentalEnableCustomTemplates was added prior to the Features struct so it follows a different model.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The primary reason i added it here was for the ConvertSubcommandTests test, since i was basically copying the other test that set up the device-frame support and wanted to make sure that the actions could be used in the test without generating the "unused variable" warning.

Copy link
Contributor

@ethan-kusters ethan-kusters Mar 3, 2023

Choose a reason for hiding this comment

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

Sorry, I'm not totally following. The DeviceFrame support example doesn't add a property here, does it? I don't think it's worth adding here if it's just for a test. We can just assert on the command and the feature flags:

XCTAssertTrue(commandWithFlag.experimentalParseDoxygenCommands)
XCTAssertTrue(FeatureFlags.current.isExperimentalDoxygenSupportEnabled)

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 in the time between when i started working on this and when i posted it, the test warning in question has been fixed! 😅 I can take this out.

/// A user-provided value that is true if experimental Doxygen support should be enabled.
///
/// Defaults to false.
@Flag(help: "Parse a limited set of Doxygen commands as equivalent DocC markup")
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
@Flag(help: "Parse a limited set of Doxygen commands as equivalent DocC markup")
@Flag(help: "Parse a limited set of Doxygen commands as equivalent Swift-DocC documentation markup")

Copy link
Contributor

Choose a reason for hiding this comment

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

In the past we've marked these as hidden but I don't have a very strong opinion here either way.

Suggested change
@Flag(help: "Parse a limited set of Doxygen commands as equivalent DocC markup")
@Flag(help: .hidden)

"line" : 49
}
},
"text" : "\\param suit The suit of the card."
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe one of these should use @ just to cover all of our bases?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good idea, i'll switch one over.

@QuietMisdreavus
Copy link
Contributor Author

@swift-ci Please test

@QuietMisdreavus
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.

🚀

@QuietMisdreavus QuietMisdreavus merged commit 72020de into swiftlang:main Mar 3, 2023
@QuietMisdreavus QuietMisdreavus deleted the doxygen branch March 3, 2023 19:07
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