Giter Site home page Giter Site logo

treora / text-fragments-ts Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 157 KB

The WICG’s Text Fragments draft specification, implemented in TypeScript

Home Page: https://code.treora.com/gerben/text-fragments-ts

License: Other

HTML 12.50% TypeScript 87.50%

text-fragments-ts's Introduction

Text Fragments — TypeScript implementation

This is an implementation of (most of) the WICG’s Text Fragments draft specification: https://wicg.github.io/scroll-to-text-fragment/.

It implements the spec line by line, in order to help serve as a reference implementation and to help test the specification. No attempt is made to e.g. increase efficiency.

A polyfill is provided to use text fragments in browsers and other HTML viewers that do not support this feature natively.

Try it out in the playground!

Status

Although intended mainly to help test and improve the specification, it works and could be used in practice. However, as the spec is still a draft, expect this implementation to change too. Note that some corners of the spec are not yet fully implemented (search for TODO comments in the source code).

Note that no effort has been made to make this run in environments that do not support ES2017.

Install

To use this implementation in your own code:

npm install "git+https://code.treora.com/gerben/text-fragments-ts.git#semver:^0.1.0"

…or equivalent.

Every definition that has been implemented is exported to allow creating compatibility tests, your own polyfill, annotation tool, or other usage (please tell about your use case!). For the precise API, please look at the exports in the source code (src/index.ts), and perhaps at how the polyfill (src/polyfill.ts) uses them.

To use the polyfill, include the package’s lib/polyfill.js into a web page (or browser extension, …):

<script src="path/to/text-fragments-ts/lib/polyfill.js" type="module"></script>

text-fragments-ts's People

Contributors

treora avatar

Stargazers

Sven avatar Bart Enkelaar avatar

Watchers

James Cloos avatar  avatar

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.