(state: StateCore)
| 94 | } |
| 95 | |
| 96 | function core(state: StateCore) { |
| 97 | let token: Token; |
| 98 | for (token of state.tokens) { |
| 99 | if (token.type !== 'fence') continue; |
| 100 | |
| 101 | if (token.info.includes(OPEN)) { |
| 102 | const start = token.info.indexOf(OPEN); |
| 103 | const end = findTagEnd(token.info, start); |
| 104 | const content = token.info.slice(start + OPEN.length, end); |
| 105 | |
| 106 | try { |
| 107 | const { meta } = parse(content.trim(), { Variable, Function }); |
| 108 | token.meta = meta; |
| 109 | } catch (error) { |
| 110 | if (!(error instanceof SyntaxError)) throw error; |
| 111 | if (!token.errors) token.errors = []; |
| 112 | token.errors.push({ |
| 113 | id: 'fence-tag-error', |
| 114 | level: 'error', |
| 115 | message: `Syntax error in fence tag: ${ |
| 116 | (error as SyntaxError).message |
| 117 | }`, |
| 118 | }); |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | if ( |
| 123 | token?.meta?.attributes?.find( |
| 124 | (attr: AttributeValue) => attr.name === 'process' && !attr.value |
| 125 | ) |
| 126 | ) |
| 127 | continue; |
| 128 | |
| 129 | token.children = parseTags(token.content, token.map[0]); |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | export default function plugin(md: MarkdownIt /* options */) { |
| 134 | md.block.ruler.before('paragraph', 'annotations', block, { |
nothing calls this directly
no test coverage detected
searching dependent graphs…