Why everybody wants some hard to reason about auto-margin-stripping?
Maybe there is a simpler way, for example to use prefix """ (with space after quotes) to set the start of line, like:
val multiLineText =
""" This is the first line.
""" Second line works fine too
""" Third line deserves 3 extra leading spaces.
""" We can use even special substrings without escaping, like """!!!
"""
""" Blank lines are OK too.
// """ This line is commented out! Normal commenting works!
""" Best part - there is no need to calculate how many leading spaces have to be stripped!
""" Though block comments like `/*` would not work an - it is part of `multiText` value.
s""" Sadly, marking line for interpolation breaks the nice alignment a bit, unless use marks all lines with `s""" ` prefix :)
This is very similar to JEP 467: Markdown Documentation Comments.
Similar proposal (by me) for ScalaDocs: Support /// as ScalaDoc indicator same as in https://openjdk.org/jeps/467.