pseudomuto / protoc-gen-doc

Documentation generator plugin for Google Protocol Buffers
MIT License
2.63k stars 464 forks source link

fix: support multi line description in markdown #486

Open bjet007 opened 2 years ago

bjet007 commented 2 years ago

When working with proto containing multi line comment, the markdown format is not generated properly as line break will corrupt the markdown table.

As we are creating proto that contains comment for the gRCP Gateway documentation, most of our field description have multi line with Example. It would be a nice addition to support that keyword in the template to, but for now we only want a valid markdown.

This merge request is trying to complete previous merge request that were never completed: https://github.com/pseudomuto/protoc-gen-doc/pull/445 https://github.com/pseudomuto/protoc-gen-doc/pull/386

thanks for @kelvie-pstg and @ayjayt for their previous attemps.

bwebster commented 2 years ago

I'm using your changes in our custom markdown template, and it's working great.

alexhayes commented 2 years ago

Can confirm this also works for me - thanks!

0rphon commented 1 year ago

i would love for this to get merged!

S1artie commented 1 year ago

We are now also using this fix as it is in a custom protoc-gen-doc fork, and it works fine! ping @pseudomuto as requested in the contribution guidelines - maybe this can be merged, it seems to be wanted by a lot of people.

lucasoares commented 1 year ago

Just saw this hahaha I also did a fork and fixed it: https://github.com/pseudomuto/protoc-gen-doc/pull/520

I did a few things different but it's almost the same thing. I also want this merged.

SpicyLemon commented 1 day ago

I just added a comment to #366: https://github.com/pseudomuto/protoc-gen-doc/issues/366#issuecomment-2394509233 about this. TL;DR: Changing {{nobr .Description}} entries to {{nobr .Description | p}} (5 places) also fixes this. An alternative fix might be to update the nobr filter to join the paragraphs with <br> instead of /n/n.