💾 Archived View for jdcard.com › link-to-text-fragments.gmi captured on 2024-08-18 at 17:46:47. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2024-05-10)

-=-=-=-=-=-=-

Link to Text Fragments

Syntax

In a similar manner to document fragments, text fragments are appended onto a URL after a hash symbol (#). The syntax however is a bit different:

https://example.com#:~:text=[prefix-,]textStart[,textEnd][,-suffix]

https://example.com#:~:text=domain

https://example.com#:~:text=domain,domain

https://example.com#:~:text=this-,domain,domain

https://example.com#:~:text=domain,domain,-in

https://example.com#:~:text=this-,domain

https://example.com#:~:text=this-,domain,-in

https://example.com#:~:text=domain&text=this-,domain&text=domain,-in

https://example.com#:~:text=domain%20is%20for,illustrative%20examples

https://example.com#:~:text=domain%20is%20for&text=illustrative%20examples

https://example.com#:~:text=illustrative,coordination

The key parts to understand are as follows:

:~:

text=

textStart

textEnd Optional

prefix- Optional

-suffix Optional

Supporting browsers will scroll to and highlight the first text fragment in the linked document that matches the specified directive. Note that it is possible to specify multiple text fragments to highlight in the same URL by separating them with ampersand (&) characters.

Usage notes

Document-Policy: force-load-at-top
Note: If the provided text fragment does not match any text in the linked document, or if the browser does not support text fragments, the whole text fragment is ignored and the top of the document is linked.

URLs with multiple text fragments

You can specify multiple text fragments to highlight in the same URL by separating them with ampersand (&) characters.

Full details are at

https://developer.mozilla.org/en-US/docs/Web/Text_fragments