@tabnas/markdown 0.6.2 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/block.d.ts +257 -0
- package/dist/block.js +213 -68
- package/dist/block.js.map +1 -1
- package/dist/engine-block.d.ts +69 -0
- package/dist/engine-block.js +99 -0
- package/dist/engine-block.js.map +1 -0
- package/dist/engine-inline.d.ts +25 -0
- package/dist/engine-inline.js +237 -0
- package/dist/engine-inline.js.map +1 -0
- package/dist/inline.d.ts +250 -0
- package/dist/inline.js +395 -215
- package/dist/inline.js.map +1 -1
- package/dist/markdown.d.ts +2 -3
- package/dist/markdown.js +91 -63
- package/dist/markdown.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/src/block.ts +224 -75
- package/src/engine-block.ts +151 -0
- package/src/engine-inline.ts +284 -0
- package/src/inline.ts +422 -218
- package/src/markdown.ts +95 -65
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { Context, MakeLexMatcher, Rule, Tabnas } from '@tabnas/parser';
|
|
2
|
+
import { BlockParser } from './block.ts';
|
|
3
|
+
import type { MdNode } from './node.ts';
|
|
4
|
+
import type { ParserOptions } from './options.ts';
|
|
5
|
+
/** The `#LB` token's `use` payload: one physical line, pre-classified. */
|
|
6
|
+
export type LineInfo = {
|
|
7
|
+
/** The line's text, terminator excluded, NULs already replaced. */
|
|
8
|
+
text: string;
|
|
9
|
+
/** True when the line holds nothing but spaces and tabs. */
|
|
10
|
+
blank: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* GFM table arming: true when the line contains a `|` or a `-` anywhere.
|
|
13
|
+
* A deliberate, *provable* superset of "could be a delimiter row": every
|
|
14
|
+
* delimiter cell requires at least one `-` (`:-:` rows open pipe-less
|
|
15
|
+
* single-column tables), and multi-column rows carry `|`. The real
|
|
16
|
+
* decision needs the container-adjusted offset only the block algorithm
|
|
17
|
+
* knows — a delimiter row nested in a block quote matches after the `>`
|
|
18
|
+
* marker — so the `gfm`-tagged alt reading this bit only *arms* the
|
|
19
|
+
* probe, and `tryOpenTable` re-verifies (see test/spec/mixed.tsv).
|
|
20
|
+
*/
|
|
21
|
+
tblArm: boolean;
|
|
22
|
+
};
|
|
23
|
+
/** The per-parse state carried on `ctx.u.md` — seeded by `parse.prepare`. */
|
|
24
|
+
export type MdParseState = {
|
|
25
|
+
bp: BlockParser;
|
|
26
|
+
meta: Record<string, any> | undefined;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Build the `mdLine` matcher: each invocation consumes one physical line —
|
|
30
|
+
* terminator included — and emits a single `#LB` token carrying the line as
|
|
31
|
+
* `LineInfo`. The matcher owns the engine's point: `sI` advances past the
|
|
32
|
+
* terminator, `rI` counts rows, and `cI` resets per line (the engine's
|
|
33
|
+
* column is not used for indentation — the shared `BlockParser` computes
|
|
34
|
+
* spec §2.2 tab-expanded columns itself).
|
|
35
|
+
*/
|
|
36
|
+
export declare const makeMdLineMatcher: MakeLexMatcher;
|
|
37
|
+
/**
|
|
38
|
+
* The three named actions of the `markdown`/`line` rules. Bound to resolved
|
|
39
|
+
* options at plugin-install time, exactly as the engine-free entry points
|
|
40
|
+
* are. `runInlines` is the phase-2 driver — the engine inline path from
|
|
41
|
+
* `engine-inline.ts` — injected so this module stays a block-phase concern.
|
|
42
|
+
*/
|
|
43
|
+
export declare function makeMdActions(opts: ParserOptions, runInlines: (doc: MdNode, refmap: Record<string, any>) => void): {
|
|
44
|
+
/** `parse.prepare`: fresh block-parser state for every parse. */
|
|
45
|
+
prepare: (_tn: Tabnas, ctx: Context, meta?: any) => void;
|
|
46
|
+
/**
|
|
47
|
+
* `line` base open alt: disarm the table probe and feed the matched
|
|
48
|
+
* `#LB` line to the shared algorithm. Reaching this alt means the
|
|
49
|
+
* `gfm`-tagged alt above it did not match — the line cannot contain a
|
|
50
|
+
* delimiter row — or GFM is off entirely (`rule.exclude` removed the
|
|
51
|
+
* tagged alt, and `tryOpenTable` is closed by the option anyway).
|
|
52
|
+
*/
|
|
53
|
+
line: (r: Rule, ctx: Context) => void;
|
|
54
|
+
/**
|
|
55
|
+
* `line` GFM open alt (tagged `g: 'gfm'`, condition on the token's
|
|
56
|
+
* `tblArm` bit): arm the table probe for this line, then feed it to the
|
|
57
|
+
* same shared algorithm. This is the extension seam a downstream
|
|
58
|
+
* dialect would use — an alt injected ahead of the base one, gated on
|
|
59
|
+
* a group tag so `gfm: false` can subtract it wholesale.
|
|
60
|
+
*/
|
|
61
|
+
lineGfm: (r: Rule, ctx: Context) => void;
|
|
62
|
+
/**
|
|
63
|
+
* `markdown` close alt (`#ZZ`): finalize blocks, run the shared inline
|
|
64
|
+
* phase, and project the public AST into the rule's node. When the
|
|
65
|
+
* caller passed `meta.md.keepTree`, the native tree is handed back on
|
|
66
|
+
* the meta object — the engine-path conformance harness renders it.
|
|
67
|
+
*/
|
|
68
|
+
finish: (r: Rule, ctx: Context) => void;
|
|
69
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* Copyright (c) 2026 Richard Rodger, MIT License */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.makeMdLineMatcher = void 0;
|
|
5
|
+
exports.makeMdActions = makeMdActions;
|
|
6
|
+
const block_ts_1 = require("./block.js");
|
|
7
|
+
const ast_ts_1 = require("./ast.js");
|
|
8
|
+
/**
|
|
9
|
+
* Build the `mdLine` matcher: each invocation consumes one physical line —
|
|
10
|
+
* terminator included — and emits a single `#LB` token carrying the line as
|
|
11
|
+
* `LineInfo`. The matcher owns the engine's point: `sI` advances past the
|
|
12
|
+
* terminator, `rI` counts rows, and `cI` resets per line (the engine's
|
|
13
|
+
* column is not used for indentation — the shared `BlockParser` computes
|
|
14
|
+
* spec §2.2 tab-expanded columns itself).
|
|
15
|
+
*/
|
|
16
|
+
const makeMdLineMatcher = (_cfg, _opts) => {
|
|
17
|
+
return (lex, _rule) => {
|
|
18
|
+
const pnt = lex.pnt;
|
|
19
|
+
const src = lex.src;
|
|
20
|
+
const seg = (0, block_ts_1.segmentNextLine)(src, pnt.sI);
|
|
21
|
+
if (null === seg)
|
|
22
|
+
return undefined;
|
|
23
|
+
const info = {
|
|
24
|
+
text: seg.text,
|
|
25
|
+
blank: (0, block_ts_1.isBlank)(seg.text),
|
|
26
|
+
tblArm: -1 !== seg.text.indexOf('|') || -1 !== seg.text.indexOf('-'),
|
|
27
|
+
};
|
|
28
|
+
const tkn = lex.token('#LB', seg.text, src.slice(pnt.sI, seg.next), pnt, info);
|
|
29
|
+
// Row/column bookkeeping is observability data (#ZZ position, traces):
|
|
30
|
+
// a consumed terminator starts a new row; an unterminated final line
|
|
31
|
+
// just widens the current one.
|
|
32
|
+
const terminated = seg.next > pnt.sI + seg.text.length;
|
|
33
|
+
pnt.sI = seg.next;
|
|
34
|
+
if (terminated) {
|
|
35
|
+
pnt.rI += 1;
|
|
36
|
+
pnt.cI = 1;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
pnt.cI += seg.text.length;
|
|
40
|
+
}
|
|
41
|
+
return tkn;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
exports.makeMdLineMatcher = makeMdLineMatcher;
|
|
45
|
+
/**
|
|
46
|
+
* The three named actions of the `markdown`/`line` rules. Bound to resolved
|
|
47
|
+
* options at plugin-install time, exactly as the engine-free entry points
|
|
48
|
+
* are. `runInlines` is the phase-2 driver — the engine inline path from
|
|
49
|
+
* `engine-inline.ts` — injected so this module stays a block-phase concern.
|
|
50
|
+
*/
|
|
51
|
+
function makeMdActions(opts, runInlines) {
|
|
52
|
+
return {
|
|
53
|
+
/** `parse.prepare`: fresh block-parser state for every parse. */
|
|
54
|
+
prepare: (_tn, ctx, meta) => {
|
|
55
|
+
const state = { bp: new block_ts_1.BlockParser(opts), meta };
|
|
56
|
+
ctx.u.md = state;
|
|
57
|
+
},
|
|
58
|
+
/**
|
|
59
|
+
* `line` base open alt: disarm the table probe and feed the matched
|
|
60
|
+
* `#LB` line to the shared algorithm. Reaching this alt means the
|
|
61
|
+
* `gfm`-tagged alt above it did not match — the line cannot contain a
|
|
62
|
+
* delimiter row — or GFM is off entirely (`rule.exclude` removed the
|
|
63
|
+
* tagged alt, and `tryOpenTable` is closed by the option anyway).
|
|
64
|
+
*/
|
|
65
|
+
line: (r, ctx) => {
|
|
66
|
+
const state = ctx.u.md;
|
|
67
|
+
state.bp.tableArmed = false;
|
|
68
|
+
state.bp.incorporateLine(r.o0.use.text);
|
|
69
|
+
},
|
|
70
|
+
/**
|
|
71
|
+
* `line` GFM open alt (tagged `g: 'gfm'`, condition on the token's
|
|
72
|
+
* `tblArm` bit): arm the table probe for this line, then feed it to the
|
|
73
|
+
* same shared algorithm. This is the extension seam a downstream
|
|
74
|
+
* dialect would use — an alt injected ahead of the base one, gated on
|
|
75
|
+
* a group tag so `gfm: false` can subtract it wholesale.
|
|
76
|
+
*/
|
|
77
|
+
lineGfm: (r, ctx) => {
|
|
78
|
+
const state = ctx.u.md;
|
|
79
|
+
state.bp.tableArmed = true;
|
|
80
|
+
state.bp.incorporateLine(r.o0.use.text);
|
|
81
|
+
},
|
|
82
|
+
/**
|
|
83
|
+
* `markdown` close alt (`#ZZ`): finalize blocks, run the shared inline
|
|
84
|
+
* phase, and project the public AST into the rule's node. When the
|
|
85
|
+
* caller passed `meta.md.keepTree`, the native tree is handed back on
|
|
86
|
+
* the meta object — the engine-path conformance harness renders it.
|
|
87
|
+
*/
|
|
88
|
+
finish: (r, ctx) => {
|
|
89
|
+
const state = ctx.u.md;
|
|
90
|
+
const { doc, refmap } = state.bp.finish();
|
|
91
|
+
runInlines(doc, refmap);
|
|
92
|
+
const md = state.meta && state.meta.md;
|
|
93
|
+
if (md && true === md.keepTree)
|
|
94
|
+
md.tree = doc;
|
|
95
|
+
r.node = (0, ast_ts_1.toAst)(doc, opts);
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
}
|
|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ClD,CAAC;QAED;;;;;WAKG;QACH,MAAM,EAAE,CAAC,CAAO,EAAE,GAAY,EAAE,EAAE;YAChC,MAAM,KAAK,GAAkB,GAAG,CAAC,CAAS,CAAC,EAAE,CAAA;YAC7C,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAA;YACzC,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;YAEvB,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE,CAAA;YACtC,IAAI,EAAE,IAAI,IAAI,KAAK,EAAE,CAAC,QAAQ;gBAAE,EAAE,CAAC,IAAI,GAAG,GAAa,CAAA;YAEvD,CAAC,CAAC,IAAI,GAAG,IAAA,cAAK,EAAC,GAAG,EAAE,IAAI,CAAC,CAAA;QAC3B,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Tabnas } from '@tabnas/parser';
|
|
2
|
+
import { InlineParser } from './inline.ts';
|
|
3
|
+
import type { MdNode } from './node.ts';
|
|
4
|
+
import type { ParserOptions, RefMap } from './options.ts';
|
|
5
|
+
/** The per-parse state carried on `ctx.u.inl` — seeded by `parse.prepare`. */
|
|
6
|
+
export type InlineState = {
|
|
7
|
+
parser: InlineParser;
|
|
8
|
+
block: MdNode;
|
|
9
|
+
};
|
|
10
|
+
/** The inline token alphabet, in the order the rule's alt lists them. */
|
|
11
|
+
export declare const INLINE_TOKENS: string[];
|
|
12
|
+
/**
|
|
13
|
+
* Build the package-private inline engine instance for one option set. All
|
|
14
|
+
* built-in matchers are disabled; the matcher set above is the complete
|
|
15
|
+
* lexical description of the inline phase.
|
|
16
|
+
*/
|
|
17
|
+
export declare function makeInlineTn(opts: ParserOptions): Tabnas;
|
|
18
|
+
/**
|
|
19
|
+
* The engine-path inline phase: the same block walk as `parseInlines`, with
|
|
20
|
+
* each block's scan driven by the engine instance's lexer. An empty subject
|
|
21
|
+
* never reaches the engine (its empty-source path returns before the rules
|
|
22
|
+
* run), and finishes the block directly — a no-op resolve, exactly as the
|
|
23
|
+
* hand scanner's `parse` does.
|
|
24
|
+
*/
|
|
25
|
+
export declare function parseInlinesEngine(inlineTn: Tabnas, doc: MdNode, refmap: RefMap, options: ParserOptions): void;
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* Copyright (c) 2026 Richard Rodger, MIT License */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.INLINE_TOKENS = void 0;
|
|
5
|
+
exports.makeInlineTn = makeInlineTn;
|
|
6
|
+
exports.parseInlinesEngine = parseInlinesEngine;
|
|
7
|
+
// The engine-facing inline driver: a second, package-private engine instance
|
|
8
|
+
// whose lexer IS the inline scanner. Each custom matcher is a thin adapter
|
|
9
|
+
// over one `InlineParser` scanner method — the same methods the engine-free
|
|
10
|
+
// path runs — so the anti-drift rule holds: recognition, node building, the
|
|
11
|
+
// delimiter stack and the bracket stack all live once, in `inline.ts`.
|
|
12
|
+
//
|
|
13
|
+
// Two engine features carry the design:
|
|
14
|
+
//
|
|
15
|
+
// * **Context-sensitive matchers.** Every adapter reaches the per-parse
|
|
16
|
+
// state through `lex.ctx.u.inl`. That is what makes the `]` matcher the
|
|
17
|
+
// cursor owner: `parseCloseBracket` consumes a successful link tail
|
|
18
|
+
// directly from the subject, and because that happens at *lex* time, the
|
|
19
|
+
// engine's point advances past the tail and everything after it is lexed
|
|
20
|
+
// fresh. The corpus-blind straddle cases (a backtick inside a successful
|
|
21
|
+
// destination or title, followed by a code span — see test/spec/mixed.tsv)
|
|
22
|
+
// are correct by construction: no token is ever cut across a tail
|
|
23
|
+
// boundary, so no re-lex or resynchronization machinery exists at all.
|
|
24
|
+
//
|
|
25
|
+
// * **Matcher order as precedence.** At `<`, the autolink adapter runs
|
|
26
|
+
// before the raw-HTML adapter, exactly as the hand scanner's dispatch
|
|
27
|
+
// tries them; the text-run adapter and the single-character literal
|
|
28
|
+
// fallback come last. The registered order *is* §6.3's precedence table,
|
|
29
|
+
// visible in the instance's configuration instead of buried in a switch.
|
|
30
|
+
//
|
|
31
|
+
// The one-token effects are applied at lex time on purpose. The engine's
|
|
32
|
+
// rule loop reads lookahead tokens before earlier alts' actions run, so any
|
|
33
|
+
// state a matcher consults — the tree for break trimming, the bracket stack
|
|
34
|
+
// for `]` — must be current when the *lexer* reaches it, not when the
|
|
35
|
+
// parser does. The `inline` rule therefore carries no per-token actions:
|
|
36
|
+
// the tokens are the observable record of the scan (subscribe with
|
|
37
|
+
// `tn.sub({lex})` and watch), and the rule's close action finalizes the
|
|
38
|
+
// block exactly as the engine-free `parse` tail does.
|
|
39
|
+
const parser_1 = require("@tabnas/parser");
|
|
40
|
+
const inline_ts_1 = require("./inline.js");
|
|
41
|
+
const C_NEWLINE = 10;
|
|
42
|
+
const C_BANG = 33;
|
|
43
|
+
const C_AMPERSAND = 38;
|
|
44
|
+
const C_ASTERISK = 42;
|
|
45
|
+
const C_LESSTHAN = 60;
|
|
46
|
+
const C_OPEN_BRACKET = 91;
|
|
47
|
+
const C_BACKSLASH = 92;
|
|
48
|
+
const C_CLOSE_BRACKET = 93;
|
|
49
|
+
const C_UNDERSCORE = 95;
|
|
50
|
+
const C_BACKTICK = 96;
|
|
51
|
+
const C_TILDE = 126;
|
|
52
|
+
/** The inline token alphabet, in the order the rule's alt lists them. */
|
|
53
|
+
exports.INLINE_TOKENS = [
|
|
54
|
+
'#IBK', // line break (soft or hard, decided against the tree)
|
|
55
|
+
'#IES', // backslash escape
|
|
56
|
+
'#ICS', // code span (or an unmatched literal backtick run)
|
|
57
|
+
'#IDL', // emphasis/strikethrough delimiter run
|
|
58
|
+
'#IOB', // [
|
|
59
|
+
'#IBG', // ![
|
|
60
|
+
'#ICB', // ] — including a consumed inline link tail
|
|
61
|
+
'#IAL', // angle autolink
|
|
62
|
+
'#IHT', // raw HTML tag
|
|
63
|
+
'#IEN', // entity reference
|
|
64
|
+
'#ITX', // ordinary text run
|
|
65
|
+
'#ILI', // single literal character nothing else claimed
|
|
66
|
+
];
|
|
67
|
+
/**
|
|
68
|
+
* Adapt one `InlineParser` scanner method into a lexer matcher: sync the
|
|
69
|
+
* parser to the engine's point, run the method (which appends nodes and
|
|
70
|
+
* moves `pos`), and emit a token covering exactly what it consumed.
|
|
71
|
+
* `name` may depend on what was consumed (`!` vs `![`).
|
|
72
|
+
*/
|
|
73
|
+
function adapt(guard, run, name, opts) {
|
|
74
|
+
return (lex) => {
|
|
75
|
+
const st = lex.ctx && lex.ctx.u && lex.ctx.u.inl;
|
|
76
|
+
if (undefined === st)
|
|
77
|
+
return undefined;
|
|
78
|
+
const pnt = lex.pnt;
|
|
79
|
+
const src = lex.src;
|
|
80
|
+
if (pnt.sI >= src.length)
|
|
81
|
+
return undefined;
|
|
82
|
+
if (!guard(src.charCodeAt(pnt.sI), opts))
|
|
83
|
+
return undefined;
|
|
84
|
+
const p = st.parser;
|
|
85
|
+
const start = pnt.sI;
|
|
86
|
+
p.pos = start;
|
|
87
|
+
if (!run(p, st.block))
|
|
88
|
+
return undefined;
|
|
89
|
+
const consumed = src.slice(start, p.pos);
|
|
90
|
+
const tkn = lex.token(name(p, start), undefined, consumed, pnt);
|
|
91
|
+
// Row/column bookkeeping is observability data: a matcher that consumed
|
|
92
|
+
// line endings (soft breaks, multiline code spans or titles) moved the
|
|
93
|
+
// scan onto a later row, and later tokens must say so.
|
|
94
|
+
let newlines = 0;
|
|
95
|
+
let lastNl = -1;
|
|
96
|
+
for (let i = 0; i < consumed.length; i++) {
|
|
97
|
+
if (10 === consumed.charCodeAt(i)) {
|
|
98
|
+
newlines += 1;
|
|
99
|
+
lastNl = i;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (0 < newlines) {
|
|
103
|
+
pnt.rI += newlines;
|
|
104
|
+
pnt.cI = consumed.length - lastNl;
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
pnt.cI += consumed.length;
|
|
108
|
+
}
|
|
109
|
+
pnt.sI = p.pos;
|
|
110
|
+
return tkn;
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
/** Build the inline matcher set for one option set. GFM strikethrough is a
|
|
114
|
+
* separate matcher registered only when the option is on — the option
|
|
115
|
+
* reshapes the registered matcher set itself, so the base dialect's lexer
|
|
116
|
+
* simply has no tilde matcher rather than a disabled branch inside one. */
|
|
117
|
+
function inlineMatchers(opts) {
|
|
118
|
+
const fixed = (n) => () => n;
|
|
119
|
+
const m = (order, guard, run, name) => ({ order, make: (() => adapt(guard, run, name, opts)) });
|
|
120
|
+
return {
|
|
121
|
+
inlBreak: m(1.00e5, (c) => C_NEWLINE === c, (p, b) => p.parseNewline(b), fixed('#IBK')),
|
|
122
|
+
inlEscape: m(1.01e5, (c) => C_BACKSLASH === c, (p, b) => p.parseBackslash(b), fixed('#IES')),
|
|
123
|
+
inlCode: m(1.02e5, (c) => C_BACKTICK === c, (p, b) => p.parseBackticks(b), fixed('#ICS')),
|
|
124
|
+
inlDelim: m(1.03e5, (c) => C_ASTERISK === c || C_UNDERSCORE === c, (p, b) => p.handleDelim(p.subject.charCodeAt(p.pos), b), fixed('#IDL')),
|
|
125
|
+
inlOpenBracket: m(1.04e5, (c) => C_OPEN_BRACKET === c, (p, b) => p.parseOpenBracket(b), fixed('#IOB')),
|
|
126
|
+
// `!` introduces an image only before `[`; otherwise it is a literal.
|
|
127
|
+
inlBang: m(1.05e5, (c) => C_BANG === c, (p, b) => p.parseBang(b), (p, start) => (2 === p.pos - start ? '#IBG' : '#ILI')),
|
|
128
|
+
// The cursor owner: on a successful inline link tail, `parseCloseBracket`
|
|
129
|
+
// has already consumed it when this token is emitted.
|
|
130
|
+
inlCloseBracket: m(1.06e5, (c) => C_CLOSE_BRACKET === c, (p, b) => p.parseCloseBracket(b), fixed('#ICB')),
|
|
131
|
+
// At `<`: autolink first, raw HTML second — matcher order is precedence.
|
|
132
|
+
inlAutolink: m(1.07e5, (c) => C_LESSTHAN === c, (p, b) => p.parseAutolink(b), fixed('#IAL')),
|
|
133
|
+
inlHtmlTag: m(1.08e5, (c) => C_LESSTHAN === c, (p, b) => p.parseHtmlTag(b), fixed('#IHT')),
|
|
134
|
+
inlEntity: m(1.09e5, (c) => C_AMPERSAND === c, (p, b) => p.parseEntity(b), fixed('#IEN')),
|
|
135
|
+
inlText: m(1.10e5, () => true, (p, b) => p.parseString(b), fixed('#ITX')),
|
|
136
|
+
// Nothing claimed the character: one literal char, same as the hand
|
|
137
|
+
// scanner's dispatch fallback.
|
|
138
|
+
inlLiteral: m(1.11e5, () => true, (p, b) => p.parseLiteralChar(b), fixed('#ILI')),
|
|
139
|
+
// GFM strikethrough: `~` runs join the delimiter stack only when the
|
|
140
|
+
// dialect is on (without it, the text matcher swallows tilde runs).
|
|
141
|
+
...(true === opts.gfm
|
|
142
|
+
? {
|
|
143
|
+
inlTilde: m(1.035e5, (c) => C_TILDE === c, (p, b) => p.handleDelim(C_TILDE, b), fixed('#IDL')),
|
|
144
|
+
}
|
|
145
|
+
: {}),
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Build the package-private inline engine instance for one option set. All
|
|
150
|
+
* built-in matchers are disabled; the matcher set above is the complete
|
|
151
|
+
* lexical description of the inline phase.
|
|
152
|
+
*/
|
|
153
|
+
function makeInlineTn(opts) {
|
|
154
|
+
const tn = new parser_1.Tabnas();
|
|
155
|
+
tn.options({ rule: { start: 'inline' } });
|
|
156
|
+
// Human descriptions for the inline alphabet, surfaced in railroad
|
|
157
|
+
// diagram legends (read off the live config by @tabnas/railroad).
|
|
158
|
+
tn.options({
|
|
159
|
+
config: {
|
|
160
|
+
modify: {
|
|
161
|
+
'inl-tokendesc': (cfg) => {
|
|
162
|
+
cfg.tokenDesc = Object.assign(cfg.tokenDesc || {}, {
|
|
163
|
+
'#IBK': 'line break (soft or hard)',
|
|
164
|
+
'#IES': 'backslash escape',
|
|
165
|
+
'#ICS': 'code span',
|
|
166
|
+
'#IDL': 'emphasis/strikethrough delimiter run',
|
|
167
|
+
'#IOB': 'link opener [',
|
|
168
|
+
'#IBG': 'image opener ![',
|
|
169
|
+
'#ICB': 'closer ] (with any consumed inline link tail)',
|
|
170
|
+
'#IAL': 'angle autolink',
|
|
171
|
+
'#IHT': 'raw HTML tag',
|
|
172
|
+
'#IEN': 'entity reference',
|
|
173
|
+
'#ITX': 'text run',
|
|
174
|
+
'#ILI': 'literal character',
|
|
175
|
+
});
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
tn.options({
|
|
181
|
+
space: { lex: false },
|
|
182
|
+
line: { lex: false },
|
|
183
|
+
string: { lex: false },
|
|
184
|
+
comment: { lex: false },
|
|
185
|
+
number: { lex: false },
|
|
186
|
+
value: { lex: false },
|
|
187
|
+
text: { lex: false },
|
|
188
|
+
lex: { match: inlineMatchers(opts) },
|
|
189
|
+
parse: {
|
|
190
|
+
prepare: {
|
|
191
|
+
'inl-reset': (_tn, ctx, meta) => {
|
|
192
|
+
;
|
|
193
|
+
ctx.u.inl =
|
|
194
|
+
meta && meta.md ? { parser: meta.md.inl, block: meta.md.block } : undefined;
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
});
|
|
199
|
+
// One OR-position over the whole alphabet: any inline token loops the
|
|
200
|
+
// rule; the empty alts fall through to the close on #ZZ. The names are
|
|
201
|
+
// minted to tins here — the same table the matchers' lex.token calls use.
|
|
202
|
+
const toks = exports.INLINE_TOKENS.map((n) => tn.token(n));
|
|
203
|
+
tn.rule('inline', (rs) => {
|
|
204
|
+
return rs
|
|
205
|
+
.clear()
|
|
206
|
+
.open([{ s: [toks], r: 'inline' }, {}])
|
|
207
|
+
.close([
|
|
208
|
+
{
|
|
209
|
+
s: '#ZZ',
|
|
210
|
+
a: (_r, ctx) => {
|
|
211
|
+
const st = ctx.u.inl;
|
|
212
|
+
st.parser.finishBlock(st.block);
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
{},
|
|
216
|
+
]);
|
|
217
|
+
});
|
|
218
|
+
return tn;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* The engine-path inline phase: the same block walk as `parseInlines`, with
|
|
222
|
+
* each block's scan driven by the engine instance's lexer. An empty subject
|
|
223
|
+
* never reaches the engine (its empty-source path returns before the rules
|
|
224
|
+
* run), and finishes the block directly — a no-op resolve, exactly as the
|
|
225
|
+
* hand scanner's `parse` does.
|
|
226
|
+
*/
|
|
227
|
+
function parseInlinesEngine(inlineTn, doc, refmap, options) {
|
|
228
|
+
const parser = new inline_ts_1.InlineParser(refmap, options);
|
|
229
|
+
(0, inline_ts_1.forEachInlineBlock)(doc, options, (block) => {
|
|
230
|
+
if (!parser.beginBlock(block)) {
|
|
231
|
+
parser.finishBlock(block);
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
inlineTn.parse(parser.subject, { md: { inl: parser, block } });
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
//# sourceMappingURL=engine-inline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine-inline.js","sourceRoot":"","sources":["../src/engine-inline.ts"],"names":[],"mappings":";AAAA,oDAAoD;;;AA6LpD,oCAsEC;AASD,gDAeC;AAzRD,6EAA6E;AAC7E,2EAA2E;AAC3E,4EAA4E;AAC5E,4EAA4E;AAC5E,uEAAuE;AACvE,EAAE;AACF,wCAAwC;AACxC,EAAE;AACF,wEAAwE;AACxE,0EAA0E;AAC1E,sEAAsE;AACtE,2EAA2E;AAC3E,2EAA2E;AAC3E,2EAA2E;AAC3E,6EAA6E;AAC7E,oEAAoE;AACpE,yEAAyE;AACzE,EAAE;AACF,uEAAuE;AACvE,wEAAwE;AACxE,sEAAsE;AACtE,2EAA2E;AAC3E,2EAA2E;AAC3E,EAAE;AACF,yEAAyE;AACzE,4EAA4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