1.0.0 • Published 6 years ago

magique v1.0.0

Weekly downloads
5
License
MIT
Repository
github
Last release
6 years ago

Magique

Magique is a dead-simple, highly-readable way to write HTML in JavaScript. It's particularly designed for templating, so if you find yourself writing a lot of wrapping tags (like and ) around strings, you'll find this package useful.

Example

import { b, i } from 'magique';

b('hello') // yields <strong>hello</strong>
i('hello') // yields <em>hello</em>

Usage

TypeScript/ES6

import { bold } from 'magique';
bold('hello');

/* OR */

import * as magique from 'magique';
magique.bold('hello');

ES5

var magique = require('magique');
magique.bold('hello');

/* OR */

var bold = require('magique').bold;
bold('hello');

Supported Tags and Aliases

TagAliasesReturnsUsage
bbold, strongstrb(str)
iitalic, emstri(str)
alinkstr or stra(str) OR a(str, href)
brN/Abr()
hXheaderstrh(level)(str) where level is between 1 and 6
h1, h2, h3, h4, h5, h6N/Astrh1(str)