gd2md-html icon indicating copy to clipboard operation
gd2md-html copied to clipboard

Remove requirement to have a TOC to have links to headers work

Open fenugeek opened this issue 6 years ago • 1 comments

One of the points of HTML is to be able to reference things via hyperlink from within the document. Currently, if I have text that is linked to a Header (which is very common), it spits out the

ERROR: undefined internal link to this URL: "#heading=h.ksq44f7qkbfg".link text: Header 2"

error unless I have a blue-link style TOC in the document previously (page ref TOC, ebven though it has embedded links too, still causes error). I know this is a known issue, but it is a big limitation in converting cross-referenced documents.

It would be really great to not have to insert a TOC at all; most of the docs I convert that have internal cross-references don't have one and never will. I imagine you could just use the embedded gdoc #id when you encounter a link, and hope it turns up later, and if it doesn't - then put out the error?

In the meantime, could it suppress this error inline the HTML if the links are stale, because with large, cross-referenced documents it is a huge amount of manual work to remove these error messages from the html every time it gets converted. This is an addition to #5 requesting something similar.

fenugeek avatar May 02 '19 17:05 fenugeek

As far as I know, there is no way to (programmatically) get references to the heading IDs without a TOC present.

I am considering an option to suppress errors, but I am going to put a strong warning at the top of the output if so, because docs may have broken links and missing images.

evbacher avatar May 20 '19 00:05 evbacher