New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mark.js

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mark.js

Highlight keywords using JavaScript. Intended for every use case. Can e.g. be used to mark text in search results.

  • 8.11.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1M
increased by6.58%
Maintainers
1
Weekly downloads
 
Created

What is mark.js?

mark.js is a JavaScript library for highlighting text. It allows you to search for text within a web page and highlight it, making it useful for search functionality, text analysis, and more.

What are mark.js's main functionalities?

Basic Text Highlighting

This feature allows you to highlight specific text within a given context. In this example, the word 'highlight' will be highlighted within the element with the class 'context'.

const Mark = require('mark.js');
const context = document.querySelector('.context');
const instance = new Mark(context);
instance.mark('highlight');

Custom Highlighting Options

This feature allows you to customize the highlighting element and class. In this example, the word 'highlight' will be wrapped in a <span> element with the class 'custom-highlight'.

const Mark = require('mark.js');
const context = document.querySelector('.context');
const instance = new Mark(context);
instance.mark('highlight', {
  'element': 'span',
  'className': 'custom-highlight'
});

Unmarking Text

This feature allows you to remove all highlights within a given context. In this example, all highlights within the element with the class 'context' will be removed.

const Mark = require('mark.js');
const context = document.querySelector('.context');
const instance = new Mark(context);
instance.unmark();

Other packages similar to mark.js

Keywords

FAQs

Package last updated on 11 Jan 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc