const is = require('unist-util-is'); const visit = require('unist-util-visit'); const sigils = { '=>': 'success', '->': 'info', '~>': 'warning', '!>': 'danger', }; module.exports = function paragraphCustomAlertsPlugin() { return function transformer(tree) { visit(tree, 'paragraph', (pNode, _, parent) => { visit(pNode, 'text', textNode => { Object.keys(sigils).forEach(sigil => { if (textNode.value.startsWith(`${sigil} `)) { // Remove the literal sigil symbol from string contents textNode.value = textNode.value.replace(`${sigil} `, ''); // Wrap matched nodes with