feat: support multiline doc strings#19
Merged
Brendan Le Glaunec (Ullaakut) merged 4 commits intomainfrom May 5, 2025
Merged
Conversation
Contributor
Nicholas Wiersma (nrwiersma)
left a comment
There was a problem hiding this comment.
Looks good, I would add an example in an actual spec test to see what it will do.
Nicholas Wiersma (nrwiersma)
approved these changes
May 5, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal of this PR
This PR attempts to add multi line doc strings support without breaking other things, but I don't like the solution I found. I'm hoping there is a better one that does not involve calling
html.EspaceStringourselves and replacing thehtml/templatewith atext/template😄Basically here the issue I faced, and I don't quite understand why it happens, is that when using the
html/templateand not escaping the return ofdocToString, I got an error that saidunknown escape sequence. When using bothhtlm.EscapeStringand thehtml/template, it ends up escaping twice of course.So Nicholas Wiersma (@nrwiersma) I hope you have an idea for a cleaner solution 😁
Another issue is that multiline-support (especially allowing empty lines to denote paragraphs) is kind of incompatible with not including the empty newlines before directives, which we obviously don't want to include. So here I specifically discard the empty newlines to avoid that issue, but it prevents doing one of the things that Carl Kittelberger (@icedream) suggested in his ticket.
Fixes #17
How did I test it?
Unit tests