Giter Site home page Giter Site logo

chunliu / sttf-url-generator Goto Github PK

View Code? Open in Web Editor NEW
69.0 4.0 1.0 17.4 MB

A Chrome/Edge extension which generates a url with text fragment.

Home Page: https://chunliu.github.io/sttf-url-generator/

License: MIT License

JavaScript 81.64% CSS 11.68% HTML 6.67%
chrome-extension scroll-to-text-fragment edge-extension text-fragment

sttf-url-generator's Introduction

Archive this repo as the browsers (at least Edge and Chrome) has the functionality built-in them (e.g. Copy link to highlight).

Icon scroll-to-text-fragment url generator

build

A Chrome/Edge extension to generate the url with the scroll-to-text-fragment for the selected text. The extension will copy the url to the clipboard and open it in a new tab.

Get it from Chrome Web Store / Edge Add-ons

How to use it

how to use

How it works

The extension works in the following way.

  • Following the suggestion of the text fragments spec, when the selection of the text snippet has less than 300 characters, the url will be generated with exact matching.
  • If the text snippet has 300 or more characters, the url will be generated with range-based matching.
    • For range-based matching, the first 5 words of the text snippet will be used as textStart, and the last 5 words will be used as textEnd.

Note

  • According to the spec, the selection of the text snippet must adhere to the word boundaries. In another words, the selection needs to start from the beginning of the first word and end at the ending of the last word of the text snippet. If the selection starts or ends at a character in a word, the browser would not be able to find the matching accurately. With v1.3, the extension helps to snap the selection to word.
  • Due to the algorithm of finding ranges in a document, the selection of the text snippet should avoid crossing multiple "block-level" elements. For example, if a selection is across a <h2> and a <div>, the browser may not be able to scroll to the text fragment accurately.

sttf-url-generator's People

Contributors

chunliu avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

wscodinglover

sttf-url-generator's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.