remark-vtranslit is a remarkjs plugin for vtranslit.
> npm i remark-vtranslit
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));
});
<h1><span class="vtranslit vtranslit-scheme-deva">नमस्कार</span> 🙏 to Everyone!!!</h1>
A double-slash ('//') can be escaped by wrting '///'. See Sample for usage.