1.0.0 โ€ข Published 2 months ago

dtext-parser v1.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
2 months ago

DText parser

DText is the e621's markdown system, it's based on many languages like BBCode, MediaWiki, Textile, etc. This module parses DText to HTML.

๐Ÿ“ฆ Install

npm i dtext-parser

or

pnpm add dtext-parser

๐Ÿงช Usage

โšก Quick start

const DText = require('dtext-parser');

DText.parse('h1.DText header')
  .then(console.log); // <h1>DText header</h1>

โš™ Config

Follow the name of the modules (codes) e.g. Bold, Italics, Code, External link, etc. then set your own class or style.

const DText = require('dtext-parser');

DText.options({
    "External link": {
      attrs: [
        {
          name: 'style',
          value: 'color: red;'
        },
        {
          name: 'class',
          value: 'extern'
        }
      ]
    }
  });
});

DText.parse('https://github.com').then(console.log);
// <a href="https://github.com" class="extern" style="color: red;">https://github.com</a>

๐Ÿง‘โ€๐Ÿ’ป Build

  1. Assuming you've already cloned this repo, install the packages with pnpm i.
  2. Source code directory is src/, test unit files are located at tests/.
  3. For unit testing, you can use pnpm test, for individual or playground testing, you can use the scripts of playground/ directory.
1.0.0

2 months ago

0.5.0

3 years ago

0.4.0

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago