Forum Bugs

Internal links not working for nginx doc

yyang
Hello, when I run:

prince http://nginx.org/en/docs/http/ngx_http_core_module.html -o out.pdf


, none of the internal links (#content) are generated. Is there any workaround, please?

Tested with v10 rev 7 and v11.1 on Windows 7 64-bit. Thanks!
mikeday
This is caused by a bug in Prince relating to empty anchor elements in a block context going missing, eg. like this:
<a name="this_is_the_anchor"></a>

It will work if the anchor contains text, is in an inline context, or if you just link directly to the id of a paragraph or heading element, which is the preferred approach.
yyang
Wow, thanks for your immediate reply! Is this expected to be fixed in the near future?

It feels more natural that an anchor is used inside an inline context, but according to MDN, it's valid that <td> contains flow content. (And it seems that <td> is neither a block element nor an inline element; it's a table cell.)

I also like the idea that an anchor should mark some "real stuff", but an empty <a> is so widely used to define an "anywhere" inside the page, that I almost never hesitate to use it when generating HTML from my code. If I feel guilty of not being semantic, I just imagine that it's HTML's equivalent of LaTeX's \hypertarget. :)

Edited by yyang

mikeday
It's perfectly legal HTML, just a limitation of our layout engine. We do hope to fix it in the future, but for now maybe you could workaround the problem by running a bit of JavaScript to grab the anchor name and put it on the block element as an id?
yyang
Sure, thanks for the suggestion.