diff --git a/doc/docgen.zig b/doc/docgen.zig index 0f6aacb465..139a58565e 100644 --- a/doc/docgen.zig +++ b/doc/docgen.zig @@ -990,9 +990,15 @@ fn tokenizeAndPrintRaw( }, .multiline_string_literal_line => { - try out.writeAll(""); - try writeEscaped(out, src[token.loc.start .. token.loc.end - 1]); - try out.writeAll("" ++ end_line ++ "\n" ++ start_line); + if (src[token.loc.end - 1] == '\n') { + try out.writeAll(""); + try writeEscaped(out, src[token.loc.start .. token.loc.end - 1]); + try out.writeAll("" ++ end_line ++ "\n" ++ start_line); + } else { + try out.writeAll(""); + try writeEscaped(out, src[token.loc.start..token.loc.end]); + try out.writeAll(""); + } }, .builtin => {