npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

datatables.mark.js

v2.1.0

Published

A DataTables plugin for mark.js to highlight search terms in tables

Downloads

2,300

Readme

datatables.mark.js

A DataTables plugin for mark.js to highlight search terms in tables

Build Status npm Version Bower Version License

Examples

Getting Started

datatables.mark.js is a plugin to integrate mark.js – a JavaScript keyword highlighter – into DataTables. It detects column specific or global searches and highlights the search term in the table.

Download

Either clone or download this plugin manually, or with npm:

$ npm install datatables.mark.js --save-dev

Or with Bower using:

$ bower install datatables.mark.js --save-dev

CDN

Alternatively the plugin is also available on the following CDN's:

Because the DataTables CDN only updates plugins at own releases and you can't specify an explicit plugin version, it's recommended to use jsDelivr.

Dependencies

This plugin depends on:

  • DataTables v1.10.6+
  • jQuery v1.7+ (necessary by DataTables)
  • mark.js v6.2+ (the jQuery version)

When using a module loader like CommonJS (e.g. Webpack) or AMD (e.g. RequireJS) they will be loaded automatically.

Integration

Finally, you'll have to embed one of these files:

  • datatables.mark.es6.js: Uncompressed ES6
  • datatables.mark.es6.min.js: Compressed ES6 (recommended when using ES6)
  • datatables.mark.js: Uncompressed ES5
  • datatables.mark.min.js: Compressed ES5 (recommended when using ES5)

into your application, by either referencing the file manually using e.g.:

<script src="vendor/datatables.mark.js/dist/datatables.mark.js"></script>

or loading it with AMD or CommonJS.

When using RequireJS you should configure the names of dependent modules as following:

  • jQuery must be named "jquery"
  • DataTables must be named "datatables.net" (defined by DataTables itself)
  • mark.js must be named "markjs"

This is important as datatables.mark.js will load these modules as dependencies. You might have a look at this example.

Usage

Activation

Activation in the DataTables options:

$(".myTable").DataTable({
    mark: true
});

Activation by default for all DataTables instances:

$.extend(true, $.fn.dataTable.defaults, {
    mark: true
});

Activation with custom mark.js options:

$(".myTable").DataTable({
    mark: {
        // ... custom option properties, e.g.
        // className: "highlight"
    }
});

Please head over to the mark.js website for an overview of possible options.

Styling

Now that you've activated the plugin you just need to define your custom styles for the highlighted elements. If you haven't defined a custom element or className in the mark.js options the default element will be mark without having a class assigned. If you don't want to have custom styles, you can embed one of the default CSS files:

Contributing

See the contribution guidelines.

Changelog

Changes are documented in release descriptions.


Happy hacking!