Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rehype-wordspan

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

rehype-wordspan

Wraps words in htag elements with span tags and does basic parts of speech parsing.

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Rehype-Wordspan

Build Status Coverage Status Js Standard Style Commitizen friendly

Span wrapping all words of a header element with rudimentary parts of speech classification.

Installation

npm:

npm install rehype-wordspan

Usage

Dependencies:

var rehype = require('rehype');
var wordSpan = require('rehype-wordspan');

Given:

var file = rehype().use(wordSpan).process('<h1>In the Heart of the Jungle</h1>');

Returns:

<h1><span class="word">In</span><span class="space"> </span><span class="word a">the</span><span class="space"> </span><span class="word">Heart</span><span class="space"> </span><span class="word p">of</span><span class="space"> </span><span class="word a">the</span><span class="space"> </span><span class="word">Jungle</span></h1>

API

rehype.use(wordSpan[, options])

At the moment there are no accepted options, but soon I will add the ability to specify which kind of html tag to catch and which classes to be applied.

All words receive a word class and all spaces receive a space class.

For now, cc is added to conjunctions. a is added to aticles. p is added to the 20 most common preopositions (the ones you are likely not using for artistic effect.) For example, Running to the car will wrap "to" as a preposition. But, Underneath the old Pickup will not wrap "Underneath."

Don't agree? That's what the issues are for. :)

License

MIT © Jesse Martin

Keywords

FAQs

Package last updated on 23 Oct 2016

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