Add a "copy target" button to anchor window


#1

It would be handy to have a “copy target” button in the anchor window. Clicking the button would copy the url needed for creating an internal hyperlink from another chapter to the anchor.


#2

PS: I exported the xhtml file of a book and looked at the hyperlinks that are created for “Custom Internal Links” (see https://guide.pressbooks.com/chapter/adding-hyperlinks-internal-and-external/).

In my export the links consist only of the actual anchor (#terminology) and do not contain the chapter url. Assuming that the xhtml export is the basis for the PDF generation this leaves me with 2 questions:

  • Why do I have to add the the url before the anchor in “Custom Internal Links” as described in the guide if it does not get exported?
  • If only the anchors get exported they have to be unique inside the book. How do I check (make sure) that anchor ids are unique inside the book?

#3

Because internal links need to work in other formats like web and EPUB. Having the full URL enables this.

There’s a ticket in pressbooks/ideas about this: https://github.com/pressbooks/ideas/issues/140


#4

Thank you. I understand your point about other export formats.
I noticed that in the insert link menu all anchors are listed too (as internal links), making it relatively easy to insert “Custom Internal Links”. The links inserted via the menu contain the full url including the folder name, not just the part after domain/folder name. The so created links work in all export formats in case of subdirectory setup. I could not check in a subdomain setup. Maybe you know if it works with full url (including the subdomain name) too. If that is the case maybe a note in the manual would help other users.

This menu shows all anchors so one can manually check for duplicates there…


#5

We will look into adding this to the documentation, thanks.