pseudomuto / protoc-gen-doc

Documentation generator plugin for Google Protocol Buffers
MIT License
2.61k stars 462 forks source link

Markdown: Trimming Descriptions breaks formatting options #428

Closed RedHawker closed 3 years ago

RedHawker commented 4 years ago

Say you want to create an indented list in a comment intended for a markdown template

/**
- Level one
   - Level two
      - Level three
*/

One would expect:

But instead, the leading spaces are removed in the .Description template field turning the output into:


If, to avoid breaking peoples' existing templates, a new field was added for Descriptions that was untouched by the ParseComments then scrub function, then the template could pull in the Raw Description and process it using the sprig template functions if things needed to be trimmed.


Edit: It seems as if the protoc-gen-go code is the culprit for stripping out spaces in block comments. As a workaround, you can use regular comments to avoid having leading spaces being stripped.

RedHawker commented 3 years ago

Going to close since I have a workaround with the regular comment format, instead of block comment.