mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
doc: fix multiline codeblock comments (#20996)
This commit is contained in:
parent
a10415faaf
commit
565cdf25b6
4 changed files with 17 additions and 1 deletions
|
@ -44,3 +44,10 @@ fn a8()
|
||||||
Fixme: this should be it's own paragraph.
|
Fixme: this should be it's own paragraph.
|
||||||
fn a9()
|
fn a9()
|
||||||
normal comment
|
normal comment
|
||||||
|
fn foo()
|
||||||
|
foo does stuff
|
||||||
|
```
|
||||||
|
this is a multiline codeblock.
|
||||||
|
second line
|
||||||
|
third line.
|
||||||
|
```
|
||||||
|
|
|
@ -9,3 +9,4 @@ fn a6()
|
||||||
fn a7()
|
fn a7()
|
||||||
fn a8()
|
fn a8()
|
||||||
fn a9()
|
fn a9()
|
||||||
|
fn foo()
|
||||||
|
|
|
@ -62,3 +62,11 @@ pub fn a8() {
|
||||||
pub fn a9() {
|
pub fn a9() {
|
||||||
println('hi')
|
println('hi')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// foo does stuff
|
||||||
|
// ```
|
||||||
|
// this is a multiline codeblock.
|
||||||
|
// second line
|
||||||
|
// third line.
|
||||||
|
// ```
|
||||||
|
pub fn foo() {}
|
||||||
|
|
|
@ -62,8 +62,8 @@ pub fn merge_doc_comments(comments []DocComment) string {
|
||||||
}
|
}
|
||||||
mut comment := ''
|
mut comment := ''
|
||||||
mut next_on_newline := true
|
mut next_on_newline := true
|
||||||
for cmt in doc_comments.reverse() {
|
|
||||||
mut is_codeblock := false
|
mut is_codeblock := false
|
||||||
|
for cmt in doc_comments.reverse() {
|
||||||
line_loop: for line in cmt.split_into_lines() {
|
line_loop: for line in cmt.split_into_lines() {
|
||||||
l := line.trim_left('\x01').trim_space()
|
l := line.trim_left('\x01').trim_space()
|
||||||
if is_codeblock {
|
if is_codeblock {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue