JSPM

@threema/threema-markup

1.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 627
  • Score
    100M100P100Q118508F
  • License MIT

A markup parser and formatter for the markup language used in Threema.

Package Exports

  • @threema/threema-markup
  • @threema/threema-markup/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@threema/threema-markup) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

threema-markup

CI

A markup parser and formatter for the markup language used in Threema.

Usage

The simplest way is to apply the markify function to text with markup.

import {markify} from '@threema/threema-markup';

const formatted = markify('*bold text with _italic_ *');
// Result: <span class="text-bold">bold text with <span class="text-italic">italic</span> </span>

By default, the following CSS class mapping is used:

  • Bold: text-bold
  • Italic: text-italic
  • Strikethrough: text-strike

But this can be customized:

import {TokenType, markify} from '@threema/threema-markup';

const formatted = markify('*bold text with _italic_ *', {
    [TokenType.Asterisk]: 'a',
    [TokenType.Underscore]: 'u',
    [TokenType.Tilde]: 't',
});
// Result: <span class="a">bold text with <span class="u">italic</span> </span>

Development

Setup

npm install

Building

npm run build

Testing

npm test

License

Licensed under either of

at your option.