Coder Social home page Coder Social logo

mrg7 / html-highlighter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dossier/html-highlighter

0.0 2.0 0.0 1.12 MB

Highlight and select phrases in HTML pages.

License: MIT License

JavaScript 95.32% HTML 3.71% CSS 0.69% Makefile 0.08% Shell 0.20%

html-highlighter's Introduction

HTML Highlighter

The HTML Highlighter is a JavaScript module that solves these problems:

  1. Display colorful highlights on words in a live Web page that are determined by either or both of these sources:
    1. User selections identified by a user dragging their pointer over a portion of a page, possibly covering multiple tags in the DOM tree.
    2. Machine selections identified by a program, which might run in the browser or in a server-side environment that processes the HTML and text of a page to decide which portions of content should be marked.
  2. Provide these offsets to either JavaScript or backend tools. StreamCorpus Pipeline is being extended to provide translation between the relative offsets generated by HTML Highlighter and the absolute character offsets used by many backend text processing tools.
  3. Provide objects isomorphic to JavaScript's Range object, which has character offsets relative to DOM nodes identified by Xpaths:
{
    start: {
        xpath: <string> // unique address to DOM node
        offset: <int> // relative character offset
    },
    end: {
        xpath: <string> // unique address to DOM node
        offset: <int> // relative character offset
    }
}

The inline comments and class documentation are sufficient for a JavaScript programmer to jump in and start using this. To see an example, you can:

    git clone git://github.com/dossier/html-highlighter
    cd html-highlighter
    $BROWSER examples/index.html

html-highlighter's People

Contributors

midsbie avatar burntsushi avatar

Watchers

James Cloos avatar eric o 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.