Giter Club home page Giter Club logo

ngx-html-highlighter's Introduction

Angular Html Highlighter

Highlight strings of text across the entire page, regardless of application, library or component boundaries.

Usage

  • Install the library in your package.json for example using npm i --save ngx-html-highlighter.
  • Add the NgxHtmlHighlighterModule.forRoot() to your module's imports section. The forRoot is necessary for the service to be available (see next item).
  • Inject the HighlighterService in your module or component.
  • Call createHighlighter with an optional options argument to create a highlighter object. The highlighter begins its work immediately.
  • Important: When no longer needed call destroy on the highlighter object or alteratively pass the highlighter to the service's destroyHighlighter method.

Options

export interface Options {
  tagAttribute: string;
  highlightClass: string;
}
  • tagAttribute is the attribute name used to "tag" a node as having been inserted by the highlighter.
  • highlightClass is the class added to the highlighted spans. You should add styles to this class in your global stylesheets (e.g. src/app/styles.css in a default angular app)

Demo

Demo

ngx-html-highlighter's People

Contributors

paviad avatar

Watchers

 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.