1.2.0 • Published 8 years ago

rehype-wordspan v1.2.0

Weekly downloads
6
License
MIT
Repository
github
Last release
8 years ago

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

1.2.0

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.0

8 years ago