You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is an issue with directive parsing in swift-markdown. It can be reproduced with this test
func testDirectiveInMultilineHTMLComment(){letcontent=""" # Some heading <!-- Some commented out text @SomeDirectiveName { Some content within the directive } --> A paragraph with some text."""letdocument=Document(parsing: content, source:nil, options:.parseBlockDirectives)XCTAssertEqual(document.debugDescription(),""" Document ├─ Heading level: 1 │ └─ Text "Some heading" ├─ HTMLBlock │ <!-- │ Some commented out text │ @SomeDirectiveName { │ Some content within the directive │ } │ --> └─ Paragraph └─ Text "A paragraph with some text."""")}
The interaction between block directives and any other Markdown/HTML syntax is awkward, and fixing this properly will require a severe rewrite of the code.
As a workaround, you can use the @Comment directive instead of an HTML comment:
@Comment {
This text will not be rendered in docs.
@Step {
This text will also not be rendered in docs.
}
}
Description
If you use a multiline HTML comment with
@Step
s inside, those steps will be rendered in docs:<!-- This text will not be rendered in docs. @Step { This text **will** be rendered in docs. } --!>
Checklist
main
branch of this package.Expected Behavior
I would expect that everything inside
<!-- -->
is omitted from rendering.Actual behavior
Instead,
@Step
s are rendered.Steps To Reproduce
Put the following in any tutorial to see that the step will be rendered:
<!-- This text will not be rendered in docs. @Step { This text **will** be rendered in docs. } --!>
Swift-DocC Version Information
Xcode 15.4
Swift Compiler Version Information
The text was updated successfully, but these errors were encountered: