-
Notifications
You must be signed in to change notification settings - Fork 11
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
Trim Leading Margin in Blockquoted Comments #57
Comments
As we discussed in chat (but I will explain here for everyone), kotlin blockquotes are "raw strings" and by default preserve leading space. The typical answer to this is Java handles this pretty reasonably in 14+. After the opening triple-quote, you MUST have a newline, but then all lines have an equal amount of whitespace trimmed from them such that there is at least one line that is empty or starts with non-whitespace, equivalent to the new String::stripIndent method which is largely compatible with kotlin's trimMargin. So when Java 17 rolls around to LTS, and Jankson officially supports Java blockquotes in 2.1.x, the natural behavior would seem to be to call String::stripIndent on the contents of a Comment annotation, which will do nothing on a Java blockquote and bring kotlin blockquotes into line with expected behavior. |
Slight note, I'm considering adding a temporary / equivalent method for 2.0.x with a big scare comment reminding me to replace it with stripIndent next version :) |
To avoid trailing stuff do: @Comment("""
Tell me and I forget.
Involve me and I remember.
Involve me and I learn.
(Benjamin Franklin)""" Java 16 Multiline feature should handle the rest. |
Kotlin Documentation:
Input:
Expected output:
v1 output:
The text was updated successfully, but these errors were encountered: