blob: 7f4b3354ad8ccfd0fcb37de310a77a1fcc68d4f9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
// @ts-nocheck
import { Parser } from '../index.js';
export default function codespan(parser: Parser) {
const start = parser.index;
const open = parser.match_regex(/(?<!\\)`{1,2}/);
parser.index += open!.length;
let raw = open;
while (parser.index < parser.template.length && !parser.match(open)) {
raw += parser.template[parser.index++];
}
parser.eat(open, true);
raw += open;
const node = {
start,
end: parser.index,
type: 'CodeSpan',
raw,
data: raw
?.slice(open?.length, open?.length * -1)
.replace(/^ /, '')
.replace(/ $/, ''),
};
parser.current().children.push(node);
}
|