UNPKG

js-markdown

Version:
40 lines (35 loc) 782 B
/** * match a escaped identifier * * valid escaped identifier: * * \ , ` , * , _ , { , } , < , > , [ , ] , ( , ), # , + , . , ! , - , ~ , " , = , ^ * */ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; function parse(str, children, renderTree) { if (/^\\[\\`\*_{}<>\[\]()#\+.!\-~"=\^]/.test(str)) { return [{ type: 'Text', rawValue: str.charAt(1) }, 2]; } return [{ type: 'Escaped', rawValue: '\\' }, 1]; } function render() { var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; var node = arguments.length > 1 ? arguments[1] : undefined; return '\\'; } var _default = { parse: parse, render: render }; exports["default"] = _default;