Open
Description
Description
a snippet slice directive must be a line comment of the form // snippet.*
. unfortunately, DocC seems to be incorrectly interpreting the contents of a multiline string literal as slice comments. for example, the following snippet
// snippet.hide
import Snippets_Example
// snippet.show
let _:String = """
Only this part of the code will be shown.
// snippet.hide
Snippet markers inside multiline string literals are ignored.
// snippet.show
"""
ought to display the entire multiline string literal, but instead i get this:
Checklist
- If possible, I've reproduced the issue using the
main
branch of this package. - This issue hasn't been addressed in an existing GitHub issue.
Expected Behavior
DocC should leave the contents of the string literal alone.
Actual behavior
DocC is interpreting comment-like substrings inside the literal as if they were actual comment tokens, and performing cuts in those locations.
this can cause serious corruption of the contents, for example:
// snippet.hide
import Snippets_Example
// snippet.show
// snippet.hide
let _:String = """
Only this part of the code will be shown.
// snippet.show
Snippet markers inside multiline string literals are ignored.
"""
will produce unbalanced string literal delimiters.
Steps To Reproduce
No response
Swift-DocC Version Information
Plugin version 1.3.0
Swift Compiler Version Information
Swift version 5.10 (swift-5.10-RELEASE)
Target: x86_64-unknown-linux-gnu