2.0.0 • Published 5 months ago

critic-markup v2.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
5 months ago

CriticMarkup

License Version Build


This package is an implementation of CriticMarkup in JavaScript as a Node.js package/module. It provides functions to parse CriticMarkup syntax or render it into HTML.

Installation

Install via npm:

npm install critic-markup

Usage

The critic-markup package exposes two functions, parse() and render(). The parse() function returns an array of all the CriticMarkup tag occurrences in a string with their most important metadata. The render() function replaces all CriticMarkup tags with their HTML equivalent in the input.

import { parse, render } from 'critic-markup';

parse(`Lorem{++ ipsum++} dolor sit amet.`);
// [{
//   type: "addition",
//   inputText: "Lorem{++ ipsum++} dolor sit amet.",
//   matchedText: "{++ ipsum++},
//   start: 5,
//   end: 17,
//   length: 12,
//   content: { addition: " ipsum" }
// }]

render(`Lorem{++ ipsum++} dolor sit amet.`);
// Lorem<ins> ipsum</ins> dolor sit amet.

Contributing

All ideas, recommendations, bug reports, pull requests are welcome. 🙂

1.0.0

5 months ago

2.0.0

5 months ago

1.1.3

6 months ago

1.1.1

3 years ago

1.1.0

3 years ago

1.1.2

3 years ago

0.5.0

3 years ago

0.4.1

4 years ago

0.4.0

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago