MCPcopy Index your code
hub / github.com/GoogleChromeLabs/link-to-text-fragment

github.com/GoogleChromeLabs/link-to-text-fragment @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
91 symbols 225 edges 7 files 29 documented · 32% updated 16d ago★ 4582 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Link to Text Fragment

  • 📖 Article: https://web.dev/text-fragments/
  • 🧩 Extension: https://chrome.google.com/webstore/detail/link-to-text-fragment/pbcodcjpfjdpcineamnnmbkkmkdpajjg
  • 🎬 Demo video: https://www.youtube.com/watch?v=Y5DmGqnzvBI

Installation

You can install the extension in your browser of choice:

  • Google Chrome: Link to Text Fragment extension
  • ~Microsoft Edge: Link to Text Fragment extension~ (No longer supported.)
  • ~Mozilla Firefox: Link to Text Fragment extension~ (No longer supported.)
  • ~Apple Safari: Link to Text Fragment extension~ (No longer supported.)

Usage

The Link to Text Fragment extension allows for the easy creation of text fragment URLs via the context menu:

  1. Select the text that you want to link to.
  2. Right-click and choose "Copy Link to Selected Text" from the context menu.
  3. If the link creation succeeded, the selected text will be briefly highlighted in yellow.
  4. Paste your link wherever you want to share it.

Text fragment selected on a webpage and contextmenu showing "Copy Link to Selected Text"

Background

The Text Fragments specification adds support for specifying a text snippet in the URL fragment.

#:~:text=[prefix-,]textStart[,textEnd][,-suffix]

When navigating to a URL with such a fragment, the user agent can quickly emphasize and/or bring it to the user's attention.

Try it out by clicking on this link: https://wicg.github.io/scroll-to-text-fragment/#ref-for-fragment-directive:~:text=%23%3A~%3Atext%3D%5Bprefix%2D%2C%5DtextStart%5B%2CtextEnd%5D%5B%2C%2Dsuffix%5D.

Acknowledgements

Text Fragments was implemented and specified by Nick Burris and David Bokan, with contributions from Grant Wang. The extension icon is courtesy of Rombout Versluijs.

License

The extension's source code is licensed under the terms of the Apache 2.0 license.

This is not an official Google product. By installing this item, you agree to the Google Terms of Service and Privacy Policy at https://www.google.com/intl/en/policies/.

Core symbols most depended-on inside this repo

checkTimeout
called by 14
fragment-generation-utils.js
backwardsEndOffset
called by 10
fragment-generation-utils.js
backwardsPrefixOffset
called by 10
fragment-generation-utils.js
getStartSearchSpace
called by 9
fragment-generation-utils.js
getSuffixSearchSpace
called by 9
fragment-generation-utils.js
normalizeString
called by 8
fragment-generation-utils.js
isBlock
called by 8
fragment-generation-utils.js
getEndSearchSpace
called by 7
fragment-generation-utils.js

Shape

Function 61
Method 28
Class 2

Languages

TypeScript100%

Modules by API surface

fragment-generation-utils.js78 symbols
service_worker.js6 symbols
content_script.js5 symbols
options.js1 symbols
offscreen.js1 symbols

For agents

$ claude mcp add link-to-text-fragment \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page