Skip to content

Conversation

@QuietMisdreavus
Copy link
Contributor

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

Summary

While Swift-Markdown has support for a limited number of Doxygen commands, the parsing logic for them has an error: When a previous block directive is present, even if it's not ready to parse content, the parser blocks Doxygen commands from being parsed. This prevents supported Doxygen commands from being parsed if they are immediately preceded by unsupported Doxygen commands, as the included test demonstrates.

This PR updates the parser logic to allow Doxygen commands to be parsed if the current state of the parser contains a block directive, so long as it is not accepting content.

Dependencies

None

Testing

To verify the behavior of the included test outside of the test harness, use the following "markdown" file:

@method doSomethingWithNumber:
@abstract Some brief description of this method
@param number Some description of the "number" parameter
@return Some description of the return value
@discussion Some longer discussion for this method

Steps:

  1. Paste the above text into test.md.
  2. swift run --package-path Tools markdown-tool dump-tree --parse-block-directives --experimental-parse-doxygen-commands test.md
  3. Ensure that the @param, @return, and @discussion commands correctly parse into their respective Doxygen command nodes.

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
  • [ n/a ] Updated documentation if necessary

@QuietMisdreavus
Copy link
Contributor Author

@swift-ci Please test

@QuietMisdreavus QuietMisdreavus merged commit b57dd89 into swiftlang:main Apr 24, 2025
2 checks passed
@QuietMisdreavus QuietMisdreavus deleted the run-on-directives branch April 24, 2025 22: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.

2 participants