1.0.0 • Published 1 year ago

@tlylt/rmark v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

RMark

RMark is a simple regex-based toy Markdown parser written in TypeScript.

Usage

Install the package:

npm install @tlylt/rmark

Import the package and use it:

import { RMark } from '@tlylt/rmark';

const rmark = new RMark();
const html = rmark.render('# Hello, world!');

Add more rules to the parser:

import { RMark, Rule, Pattern } from '@tlylt/rmark';

const rmark = new RMark();
rmark.addRule(
    new Rule('horizontal', [
    new Pattern(/^(-{3})/gm, '<hr />'),
    new Pattern(/^(_{3})/gm, '<hr />'),
    ])
);
const html = rmark.render('---');
1.0.0

1 year ago