protoc-gen-doc icon indicating copy to clipboard operation
protoc-gen-doc copied to clipboard

Html bookmarks are incorrect for submessages

Open CptanPanic opened this issue 6 years ago • 4 comments

I am having problems whereas is if I have a submessage, so a protobuf message that contains field of another message, the html bookmark doesn't work correctly. For the attached example

syntax = "proto3";

message TestMessage{
   ArmType arm_type = 1;
}

message ArmType{
  bool hello = 1;
}

So in the generated html doc, the first link to ArmType is correct, <a href="#.ArmType">

but the second link is missing the '.' , <td><a href="#ArmType">ArmType</a></td>

Sorry I am a system whereas I can't install go compiler, etc so can't use from source.. So can only use prebuilt versions.

Attached is example proto and result html file. Note that if you click on ArmType link in description of TestMessage nothing happens because anchor is wrong, see line 242 of .html.

Downloads.zip

Generated with

protoc --plugin=/opt/protoc-gen-doc --doc_out=./doc --doc_opt=html,index.html test.proto

CptanPanic avatar Mar 16 '18 13:03 CptanPanic

You can fix this in the short-term by adding a package com.example to your protobuf files, the problem happens when you don't specify one.

If you want to wait I tried fixing it here: https://github.com/pseudomuto/protokit/pull/3

jlubawy avatar Aug 30 '18 23:08 jlubawy

Sure would be helpful to me if this were fixed...I can't control the protobuf source I'm documenting.

MaggieLeber avatar May 29 '19 18:05 MaggieLeber

Hi @jlubawy , was your PR closed just due to inactivity or are there some other reasons like offline discussion with the repository maintainer? The problem seem to be still present :worried:

michalkaptur avatar Jan 29 '24 12:01 michalkaptur

I closed it trying to clean up old PRs that were never merged. Feel free to try and open a new PR, the code change is here https://github.com/jlubawy/protokit/commit/a81098c6b2ce862c17e36c23847c8b92e41cd913

jlubawy avatar Jan 30 '24 00:01 jlubawy