How Do I Remove Link Underlines In Compile?

Hi there,

I’m compiling my book to two formats - eBook (ePub and MOBI, so really three formats), and Word .docx. My book contains Scrivener links from certain words in the text to their entries in the book’s appendix. However, in the ebook version, I don’t want the links to be underlined; I want them just to be blue, without any underlines beneath them. In the .docx file, I don’t want any hyperlinks at all; I want them removed completely. How can I achieve these effects? Help!

Furthermore, I want the text of the link itself to read something like the phrase “Terry ‘Gadget’ Anders”, but the actual title of the document it links to will be “Anders, Terry ‘Gadget’”. How do. I do this WITHOUT the text of the document being “updated” to match the title of the document it links to when compiling? And without breaking the link?

Hey now, as someone that exclusively uses eInk to read ebooks, “blue” hyperlinks with no other standard signal sounds like a mistake to me. While you might be able to suppress them for some ePub readers, using CSS, I don’t think you’ll have much luck with Kindle.

  • Removing hyperlinks from a document: enable the Remove all hyperlinks option in general options of the compile overview screen. Take care with this setting though, since it is a general compile option it applies to all formats where relevant. You will need to toggle it when switching between ebook and word processing files.
  • Regarding hyperlink text updating to match the title, strangely enough that should only be happening if the hyperlink text in the editor precisely matches the document title of the binder item it links to (and then we’re talking about adding any compile-time stuff like “Chapter Twenty-Three - Name of Item”). Without that behaviour it would be impossible to use your own link text at all. So I cannot reproduce a scenario where the link text “Terry ‘Gadget’ Anders” transforms into “Anders, Terry ‘Gadget’”.

Well, I’ve been re-reading Clive Barker’s book, Imajica on my iPad, in ePub format, and it uses just “blue” text without any underlines for its hyperlinks to its appendix. That’s what I’m trying to do, see. I’m writing a science fiction/fantasy novel, and within the text of the book, I’m creating links from all the fancy, made-up names for all the alien races, gadgets, gizmos, and character names to their entries in the “Appendix” at the end of the book, so readers can tap on a name or a term, and jump to its entry in the appendix to have a look-see at its summary or definition. I don’t want underlines beneath them because they clutter up the text and make it look ugly, quite frankly.

And the reason the link text will not match the name of the actual appendix entry is because a lot of times, the link text will have the word “The” as part of it, but the document it links to will not have that as part of its title.

And I don’t know ANYTHING about CSS, so I don’t know how to edit the CSS in the Compiler to make it do what I want.

If you’re reading using Apple Books (nee iBooks) on an iPad, linked text will be blue with no underline by default - you don’t need to do anything special to get that effect. The Clive Barker book you are reading almost certainly leaves the link formatting to the e-reader, as does Scrivener.

Ioa is right, that you really shouldn’t force this. Having links blue but not underlined works well in Apple Books because you are dealing with a colour screen. On an e-ink reader, though - and remember that ePub files can be read on e-ink readers - if the link is not underlined, then the reader has no way to tell it’s a link at all. For this very reason, I believe, it’s not even possible to turn off link underlines on a Kindle - even if you add the necessary CSS to do so, Amazon’s Kindle code ignores it and shows an underline anyway.

If you really want to try to force links not to use an underline on devices that support it (as I say, this won’t work on a Kindle), you add this to the end of the CSS:

a:link {text-decoration:none;}\na:visited {text-decoration:none;}\na:hover {text-decoration:none;}

Likewise, if you wanted to force Apple Books to use underlines (I know this is the opposite of what you want to do, but this is just an example), you would use this:

a:link {text-decoration:underline;}\na:visited {text-decoration:underline;}\na:hover {text-decoration:underline;}

In both of these cases, though, you are asking the e-reader not to use its standard link formatting and to do something else; whether this will work will differ from e-reader to e-reader. I strongly recommend you don’t add this, though, and just leave the e-reader to determine how links look, because otherwise you are working against reader expectation - readers will be used to seeing links presented in a certain way in the e-reader of their choice. And, as I say, links will look how you want in Apple Books anyway.

Note that all of the above relates to KF8 and ePub 3; if you’re using ePub 2, there is an option to turn off link underlines in the “Transformations” options, but it’s really only there because it’s part of an outdated format.

All the best,
Keith

Again not every reader may respect this (they can even override colour—for example iBooks in dark mode will disregard your choice), but here is some simple CSS you can try:

a { text-decoration: none; color: #1681B5 }

The colour I provided is a shade of blue, but obviously that part is arbitrary. You’d want to put this into the CSS compile option pane.

Though I wonder if some other approach might be better for what you’re doing? Maybe the text itself is unadorned, but there is a small symbol after the phrase that takes you to the glossary? Here’s something to play with as an idea:

/* Show links as adornment */ .section a { text-decoration: none; color: inherit; } .section a:after { content: "Ⓘ"; color: #1681B5; font-size: 0.5em; vertical-align: super; }

Note this presumes you are using the “Text Section” Layout for your scene text, which by default uses the CSS class name, “section”. Hence what we’re doing here is scoping the hyperlink appearance override to only work on scene text—stuff like the ToC will be left alone. The nice thing about this approach is that while you click on the link indication symbol, the whole text is still a link it just doesn’t look like one. So the odds of someone struggling to finger-tap on a tiny little footnote sized thing is low.

I should note I have not extensively tested that precise Unicode character in the “content” line above, but it seems to work in Kindle Previewer and Adobe Digital Editions. You can also use images here, by encoding them to base64. Here for example is a very similar look as the above, only using the typical square-with-arrow “link” icon:

/* Show links as adornment */ .section a { text-decoration: none; color: inherit; } .section a:after { content: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAQCAYAAAAvf+5AAAABG2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS41LjAiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIi8+CiA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgo8P3hwYWNrZXQgZW5kPSJyIj8+Gkqr6gAAAYJpQ0NQc1JHQiBJRUM2MTk2Ni0yLjEAACiRdZHPK0RRFMc/Zsg0iGJhYTFpWA2NmZrYKCMNJU1jlMFm5pkfan683nuTZKtspyix8WvBX8BWWStFpGRhZU1smJ7zjJpJ5tzOPZ/7vfec7j0XbNGsktMbvZDLG1okFHTNxxZczc846aAFP464oqtj4fA0de3jjgYr3gxYteqf+9dalpO6Ag0O4VFF1QzhSeHpVUO1eFu4S8nEl4VPhT2aXFD41tITFX6xOF3hL4u1aGQcbB3CrnQNJ2pYyWg5YXk57ly2qPzex3pJazI/NyuxV7wHnQghgriYYoJxAgwxInOAAXwMyoo6+d6f/BkKkqvIrLKGxgppMhh4RC1K9aTElOhJGVnWrP7/7aue8vsq1VuD0PRkmm990LwF5ZJpfh6aZvkI7I9wka/mFw5g+F30UlVz70P7BpxdVrXEDpxvQveDGtfiP5Jd3JZKwesJtMWg8xqci5We/e5zfA/RdfmqK9jdg3453770DUJcZ9UCb7suAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAfUlEQVQoke3OOwoCQRCE4U9cTWQwMhAzc0PZxMjIE3gBE+/icTWR9RXYA8OyE5j7Q0M/iqrmyx2PqAv2eEd1Cp7YYIEZGpxD9OoLV8V8xBWncB0NCXe44YAp2prjGtvoU/xcjc4s46YplgnznjDlJj/ZYTzgmNMmldufH/kAPO4XW3NTrIoAAAAASUVORK5CYII=); }

As to how to get an image converted into “CSS” like that, there are hundreds of such converters online. I just use the macOS command-line tool “base64” though. This signal could be a simple as a little asterisk if you really want though. It doesn’t have to be Unicode or icons. In fact I just read an ebook recently that used asterisks to link to appendix entries.

Well that should be fine, as far as I understand what you are looking to do. If I link to a document called “Greta Garbo” with the text “Anything But ‘Greta Garbo’”, then nothing should ever be changed about the visible hyperlink text. It’s only when the two precisely match that the compiler will adjust the link text (by default, you can switch this off in the Document Title Links compile format pane).

Maybe I’m completely misunderstanding what you mean though.

Thank you guys so much for taking the time and effort to reply! I really appreciate it. But, if Apple Books does this by default and Kindle underlines by default , I really don’t want to mess with it. Thanks though for your thoughtful input! I will bookmark this page in case I ever need to know this stuff! :smiley: