Skip to content

Latest commit

 

History

History
30 lines (22 loc) · 617 Bytes

File metadata and controls

30 lines (22 loc) · 617 Bytes

wp-shortcodes.js Build Status

Render WP style shortcodes with your own custom rules

Inspired by shortcode.js

Usage

var text = "[first name=hello] [second]world![/second]";

var tags = {
	first: function(){
		return this.options.name;
	},
	second: function(){
		return this.contents;
	}
}

var out = new Shortcode(text, tags).get();
console.log(out); // hello world!

How to Test

Tests are run with mocha/chai

>npm test