pseudomuto / protoc-gen-doc

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

Leading spaces and tabs in comments are swallowed up (removed, trimmed, etc) in all comments #438

Open raywdude opened 3 years ago

raywdude commented 3 years ago

We are looking to use this plugin for our library, so having user friendly, consistent documentation is very important.

An issue we have been seeing with this plugin is that when we put any kind of comments within our .proto files that have intentional leading spaces and/or tabs, they are stripped out completely in the output HTML file.

For example:

/**
 * <b>Usage</b>
 * <pre>
 *    XYZBuilder.newBuilder()
 *        .setX(..)
 *        .setY(..)
 *        .build();
 * </pre>
 */

Gets output in the HTML file as:

Usage
XYZBuilder.newBuilder()
.setX(..)
.setY(..)
.build();

We also tried the different variations of comments:

/*
 * <b>Usage</b>
 * <pre>
 *    XYZBuilder.newBuilder()
 *        .setX(..)
 *        .setY(..)
 *        .build();
 * </pre>
 */
// <b>Usage</b>
// <pre>
//    XYZBuilder.newBuilder()
//        .setX(..)
//        .setY(..)
//        .build();
// </pre>

And these made no difference.

We are using protoc-gen-doc v1.4.1, the latest stable release.

Could you please kindly fix this?

Thanks, Ray