Asciidoctor-pdf: Support Hiding Link URLs

Created on 27 Oct 2018  Â·  17Comments  Â·  Source: asciidoctor/asciidoctor-pdf

Please add an option to support hiding of link URLs in Asciidoctor PDF.

Sample case:

http://google.com/[Google].

Current output from Asciidoctor PDF:

Google [http://google.com/].

With the option enabled, the output would be merely:

Google.

Note: in both cases, the text should still be clickable (depending on the PDF reader software).

Most helpful comment

Primarily focused on 2-sided printing, but can be used on-screen, inline URIs.
Recto/verso, links are clickable, URIs are inserted inline.
— This seems covered by media=prepress.

This is where it's clear we need something new. prepress is not designed for screen and it could continue to diverge from screen. If we want recto/verso and screen, that's a new media type.

All 17 comments

The behavior you're observing is activated by the media=prepress attribute. That media type is designed for publishing to paper, which is why the URL is shown separately. If you want a normal, clickable link, simply change the media attribute to screen or print (or don't set it).

The situation is: I would like to use media-prepress (it looks great), but I would only like to disable the printing of link URLs. Would that be possible?

Is your intention to print the document? Meaning, do you want the links hidden because in print form you simply want links to appear as normal text?

My intention is twofold:

  1. share the document in digital form, where the links are clickable, and
  2. allow the document to be printed, where the links are (obviously) not clickable.

Note: In the future, when Asciidoctor PDF can supports printing links as footnotes or endnotes, I would prefer that instead. That would be the optimal solution in my case.

share the document in digital form, where the links are clickable, and

In that case, you should use media=screen.

allow the document to be printed, where the links are (obviously) not clickable.

In this case, I could see having a setting that disables the printing of the URI separately. You may just want the link to be something that is there if it's on screen, but not there if it's in print. The DocBook toolchain has something similar called "ulink.show=0". Perhaps we can have something like show-link-uri! or an explicit hide-link-uri. (I think I prefer the latter).

I don't want to use media=screen and the reason is that I want to distribute one PDF file and it should look great. Then people can see it on their screens, and click the links if they want to. Then they may decide to print that document.

So my aim is to produce a single PDF, that will be slightly more functional on screen (clickable links) than it is when printed.

In this case, I could see having a setting that disables the printing of the URI separately.

That would be exactly what I'm looking for.

The DocBook toolchain has something similar called "ulink.show=0".

Indeed, I found that, but then found it (obviously) doesn't apply to the Asciidoctor PDF toolchain.

Perhaps we can have something like show-link-uri! or an explicit hide-link-uri. (I think I prefer the latter).

To be honest I have no idea what's better or more consistent. I'll gladly use anything that is offered.

My proposal still wouldn't cover what you are after. Because if you set media=prepress with hide-link-uri, then the link won't be a link at all.

media=prepress is intentionally not designed for screen, so it really shouldn't be used for that purpose. It's designed for a printing a bound book. So I still argue that what you want is media=screen. A document for screen can still be printed, of course, but it also works when on screen.

The media=prepress is adding logic for printing recto/verso pages, which makes very little sense for on screen viewing.

Btw, the reason that the URI shows separately for media=prepress (or media=print) is because users specifically did not want the text to be a link or to be a different color. So if we make it a link, then we would undo that enhancement. But since you want just a regular link, then that's what media=screen gives you.

(So I'm curious why media=screen is not sufficient for your needs).

In my experience, users/readers expect PDFs to look good on screen and be nicely printable.

I have tried media=screen, but it would not print every chapter on an odd page, which would be great when printing. That's why I switched to media=prepress.

And in my view nicely printable means that there are no link URIs scattered through the text all over the place. So for me, media=prepress is perfect, except for the printed links.

Perhaps I should approach it the other way around, and go for media=screen and then somehow configure Asciidoctor PDF to start each section on an odd page?

Or perhaps another intermediate solution would be to add an option to print link URIs in footnotes, and then hide them, pending actual support for such footnotes?

it would not print every chapter on an odd page, which would be great when printing.

Assuming a single feed printer, all you would be doing is inserting blank pages. If I were printing the document, I would just be discarding these pages, not to mention the paper they waste. Skipping pages is really only needed when you are making a bound book, because you actually have a psychical constraint. Surely your users aren't binding books.

Perhaps I should approach it the other way around, and go for media=screen and then somehow configure Asciidoctor PDF to start each section on an odd page?

I'd love to ask your readers, but I really don't think they want blank pages in the document. Based on everything else you describe, what you want is media=screen. But you also want blank pages, which to me is an odd requirement. But if you are sticking with that requirement, you are essentially proposing a new media type that treats links like screen, but inserts blank pages like a published book.

Or perhaps another intermediate solution would be to add an option to print link URIs in footnotes, and then hide them, pending actual support for such footnotes?

Since Asciidoctor PDF can't make footnotes at the bottom of the page, it's not really worth discussing this avenue at this point.

Assuming a single feed printer, all you would be doing is inserting blank pages.

Double-sided printing is a common feature nowadays. Even my home printer (less than EUR 100) supports it. So while I would not call the result is a “book” per se, perhaps “whitepaper” would be a more appropriate term…

The thing is, what Asciidoctor PDF currently provides is already great. It's only the links that look a bit messy to me. But it's not a showstopper in any way.

From my POV, if I would only get an option to hide the spelled-out URIs, without losing anything else (e.g. clickable links), that would be optimal.

Double-sided printing is a common feature nowadays.

Ah, okay, Now I see what you're getting at. That makes sense. (While my printer can't do this, I know that many can).

The hiding of the URI makes complete sense to me. What still doesn't make sense is how to hide the URI and still have the link be clickable on screen. Up to this point, we have treated these two uses cases as mutually exclusive. You either have a clickable link for screen, or the URI is moved to the side (or even not shown). And the reason the text is not clickable in prepress is because users don't want the linked text to look different on paper (because it would be meaningless).

While it's easy to say that it's just this one feature, we have to understand how to express this semantically since it's never just one feature. What media type is this? It has the layout of prepress, but it's designed for screen. I'd be happy with something like screenpress. It's a little funky, but gets the point across. It means it's optimized for screen first, but prints a lot like prepress.

(Btw, I still think there is a case for hide-link-uri, but it's not the case you're talking about since you still want the link to be functional, which is a different thing).

I'm not sure a new media type is the way to go, since I just don't have any expertise in this area. It does sound like it make the feature into something bigger than I thought it would have to be.

Taking a bit more of a helicopter view, this is what I can see as useful cases for producing a PDF from AsciiDoc content:

  1. Primarily focused on on-screen viewing.
    No recto/verso, links are clickable, URIs are not printed.
    — This seems covered by media=screen.
  2. Primarily focused on 2-sided printing, but can be used on-screen, inline URIs.
    Recto/verso, links are clickable, URIs are inserted inline.
    — This seems covered by media=prepress.
  3. Primarily focused on 2-sided printing, but can be used on-screen, hide URIs.
    Recto/verso, links are clickable, URIs are completely hidden.
    — This is currently not supported in Asciidoctor PDF, but may be easy to support with an option to hide the inline URIs.
  4. Primarily focused on 2-sided printing, but can be used on-screen, print URIs outside context.
    Recto/verso, links are clickable, URIs go into footnotes or endnotes.
    — This is currently not supported in Asciidoctor PDF, and is not expected to be supported anytime soon.

Currently I'm using option 2, while option 3 would be even better, and option 4 being the best possible.

Again, happy to use any approach you can offer…

Primarily focused on 2-sided printing, but can be used on-screen, inline URIs.
Recto/verso, links are clickable, URIs are inserted inline.
— This seems covered by media=prepress.

This is where it's clear we need something new. prepress is not designed for screen and it could continue to diverge from screen. If we want recto/verso and screen, that's a new media type.

Hi. I was searching for a method to hide links from the prepress PDF and I stumbled upon this issue.

I'd like to show the links in text (so that the output looks like this: "Visit page [https://example.com]"), but not show it when I put the whole link (so that the output looks like this: "Visit https://example.com/"). Now this is exactly what happens, but when I insert an email, the full URL is shown (with the mailto protocol). Is there a way I can hide it from the output without touching the current behaviour in the other cases?

Was this page helpful?
0 / 5 - 0 ratings