feat: allow using raw docstring for type docs by logikone · Pull Request #28 · elastic/crd-ref-docs · GitHub
Skip to content

feat: allow using raw docstring for type docs#28

Merged
thbkrkr merged 1 commit into
elastic:masterfrom
logikone:type-docstring-raw
Jul 5, 2022
Merged

feat: allow using raw docstring for type docs#28
thbkrkr merged 1 commit into
elastic:masterfrom
logikone:type-docstring-raw

Conversation

@logikone

@logikone logikone commented Jul 1, 2022

Copy link
Copy Markdown
Contributor

closes #27

Comment thread config/config.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming: maybe this is more explicit?

Suggested change
TypeDocstringRaw bool `json:"typeDocstringRaw"`
UseRawDocstring bool `json:"useRawDocstring"`

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated 👍

Comment thread processor/processor.go Outdated
}

if p.typeDocstringRaw && info.RawDecl != nil {
typeDef.Doc = info.RawDecl.Doc.Text()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment?
Also, I see a new line added at the end, should we remove it?

Suggested change
typeDef.Doc = info.RawDecl.Doc.Text()
// use raw comments doc to support multi-line and indent preservation
typeDef.Doc = strings.TrimSuffix(info.RawDecl.Doc.Text(), "\n") // remove trailing newline

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commend add and newline trimmed 👍

@logikone logikone force-pushed the type-docstring-raw branch 2 times, most recently from 7b7e9c0 to c81a784 Compare July 5, 2022 18:29
@logikone logikone force-pushed the type-docstring-raw branch from c81a784 to 3011fd5 Compare July 5, 2022 18:30
@logikone logikone requested a review from thbkrkr July 5, 2022 18:37

@thbkrkr thbkrkr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thbkrkr thbkrkr merged commit 49339ae into elastic:master Jul 5, 2022
@mowies

mowies commented Feb 22, 2023

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeInfo.RawDecl.Doc instead of TypeInfo.Doc for Type documentation

3 participants