doc: fix multiline codeblock comments (#20996)

This commit is contained in:
Turiiya 2024-03-11 17:16:09 +02:00 committed by GitHub
parent a10415faaf
commit 565cdf25b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 17 additions and 1 deletions

View file

@ -44,3 +44,10 @@ fn a8()
Fixme: this should be it's own paragraph.
fn a9()
normal comment
fn foo()
foo does stuff
```
this is a multiline codeblock.
second line
third line.
```

View file

@ -9,3 +9,4 @@ fn a6()
fn a7()
fn a8()
fn a9()
fn foo()

View file

@ -62,3 +62,11 @@ pub fn a8() {
pub fn a9() {
println('hi')
}
// foo does stuff
// ```
// this is a multiline codeblock.
// second line
// third line.
// ```
pub fn foo() {}

View file

@ -62,8 +62,8 @@ pub fn merge_doc_comments(comments []DocComment) string {
}
mut comment := ''
mut next_on_newline := true
for cmt in doc_comments.reverse() {
mut is_codeblock := false
for cmt in doc_comments.reverse() {
line_loop: for line in cmt.split_into_lines() {
l := line.trim_left('\x01').trim_space()
if is_codeblock {