Skip to content

vipranarayan14/remark-vtranslit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

remark-vtranslit

remark-vtranslit is a remarkjs plugin for vtranslit.

Setup

> npm i remark-vtranslit

Usage

Code

const rehypeStringify = require('rehype-stringify');
const remarkParse = require('remark-parse');
const remarkRehype = require('remark-rehype');
const unified = require('unified');
const remarkVtranslit = require('remark-vtranslit');

const { vTranslitSchemeItrn } = require('vtranslit-scheme-itrn');
const { vTranslitSchemeDeva } = require('vtranslit-scheme-deva');

const markdownString = '# //namaskAra// 🙏 to Everyone!!!';

unified()
    .use(remarkParse)
    .use(remarkVtranslit, [
        vTranslitSchemeItrn,
        vTranslitSchemeDeva
    ])
    .use(remarkRehype)
    .use(rehypeStringify)
    .process(markdownString, (err, file) => {
        
        console.log(err || String(file));
        
    });

Output:

<h1><span class="vtranslit vtranslit-scheme-deva">नमस्कार</span> 🙏 to Everyone!!!</h1>

Escaping '//'

A double-slash ('//') can be escaped by wrting '///'. See Sample for usage.

License

MIT (c) Prasanna Venkatesh T S