From 1b2bbeaa67c1d7b9b1cdc5cd4355616d7930708b Mon Sep 17 00:00:00 2001 From: kelvie-pstg <48775138+kelvie-pstg@users.noreply.github.com> Date: Mon, 24 May 2021 15:13:37 -0700 Subject: [PATCH] markdown: Better handle line breaks inside tables If you have a double linebreak in the comments in the protofile it completely breaks the table. This translates it to

to make unbreak it and make it look nicer. --- resources/markdown.tmpl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/resources/markdown.tmpl b/resources/markdown.tmpl index 0e231be1..2364fdf5 100644 --- a/resources/markdown.tmpl +++ b/resources/markdown.tmpl @@ -41,7 +41,7 @@ | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | {{range .Fields -}} - | {{.Name}} | [{{.LongType}}](#{{.FullType}}) | {{.Label}} | {{if (index .Options "deprecated"|default false)}}**Deprecated.** {{end}}{{nobr .Description}}{{if .DefaultValue}} Default: {{.DefaultValue}}{{end}} | + | {{.Name}} | [{{.LongType}}](#{{.FullType}}) | {{.Label}} | {{if (index .Options "deprecated"|default false)}}**Deprecated.** {{end}}{{.Description | replace "\n\n" "

" | nobr}}{{if .DefaultValue}} Default: {{.DefaultValue}}{{end}} | {{end}} {{end}} @@ -49,7 +49,7 @@ | Extension | Type | Base | Number | Description | | --------- | ---- | ---- | ------ | ----------- | {{range .Extensions -}} - | {{.Name}} | {{.LongType}} | {{.ContainingLongType}} | {{.Number}} | {{nobr .Description}}{{if .DefaultValue}} Default: {{.DefaultValue}}{{end}} | + | {{.Name}} | {{.LongType}} | {{.ContainingLongType}} | {{.Number}} | {{.Description | replace "\n\n" "

" | nobr}}{{if .DefaultValue}} Default: {{.DefaultValue}}{{end}} | {{end}} {{end}} @@ -64,7 +64,7 @@ | Name | Number | Description | | ---- | ------ | ----------- | {{range .Values -}} - | {{.Name}} | {{.Number}} | {{nobr .Description}} | + | {{.Name}} | {{.Number}} | {.Description | replace "\n\n" "

" | nobr}} | {{end}} {{end}} @@ -76,7 +76,7 @@ | Extension | Type | Base | Number | Description | | --------- | ---- | ---- | ------ | ----------- | {{range .Extensions -}} - | {{.Name}} | {{.LongType}} | {{.ContainingLongType}} | {{.Number}} | {{nobr .Description}}{{if .DefaultValue}} Default: `{{.DefaultValue}}`{{end}} | + | {{.Name}} | {{.LongType}} | {{.ContainingLongType}} | {{.Number}} | {{.Description | replace "\n\n" "

" | nobr}}{{if .DefaultValue}} Default: `{{.DefaultValue}}`{{end}} | {{end}} {{end}} @@ -89,7 +89,7 @@ | Method Name | Request Type | Response Type | Description | | ----------- | ------------ | ------------- | ------------| {{range .Methods -}} - | {{.Name}} | [{{.RequestLongType}}](#{{.RequestFullType}}){{if .RequestStreaming}} stream{{end}} | [{{.ResponseLongType}}](#{{.ResponseFullType}}){{if .ResponseStreaming}} stream{{end}} | {{nobr .Description}} | + | {{.Name}} | [{{.RequestLongType}}](#{{.RequestFullType}}){{if .RequestStreaming}} stream{{end}} | [{{.ResponseLongType}}](#{{.ResponseFullType}}){{if .ResponseStreaming}} stream{{end}} | {{.Description | replace "\n\n" "

" | nobr}} | {{end}} {{end}}