@the_dissidents/libemmm 0.0.5 → 0.0.8

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.
Files changed (125) hide show
  1. package/README.md +28 -15
  2. package/dist/index.d.mts +124 -44
  3. package/dist/index.d.ts +124 -44
  4. package/dist/index.js +547 -227
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +544 -227
  7. package/dist/index.mjs.map +1 -1
  8. package/package.json +4 -1
  9. package/dist/src/builtin/builtin.d.ts +0 -2
  10. package/dist/src/builtin/builtin.js +0 -18
  11. package/dist/src/builtin/builtin.js.map +0 -1
  12. package/dist/src/builtin/define-modifier.d.ts +0 -12
  13. package/dist/src/builtin/define-modifier.js +0 -129
  14. package/dist/src/builtin/define-modifier.js.map +0 -1
  15. package/dist/src/builtin/define-shorthand.d.ts +0 -14
  16. package/dist/src/builtin/define-shorthand.js +0 -178
  17. package/dist/src/builtin/define-shorthand.js.map +0 -1
  18. package/dist/src/builtin/internal.d.ts +0 -41
  19. package/dist/src/builtin/internal.js +0 -106
  20. package/dist/src/builtin/internal.js.map +0 -1
  21. package/dist/src/builtin/module.d.ts +0 -16
  22. package/dist/src/builtin/module.js +0 -156
  23. package/dist/src/builtin/module.js.map +0 -1
  24. package/dist/src/builtin/slot.d.ts +0 -7
  25. package/dist/src/builtin/slot.js +0 -136
  26. package/dist/src/builtin/slot.js.map +0 -1
  27. package/dist/src/builtin/var.d.ts +0 -12
  28. package/dist/src/builtin/var.js +0 -103
  29. package/dist/src/builtin/var.js.map +0 -1
  30. package/dist/src/debug-print.d.ts +0 -14
  31. package/dist/src/debug-print.js +0 -113
  32. package/dist/src/debug-print.js.map +0 -1
  33. package/dist/src/debug.d.ts +0 -15
  34. package/dist/src/debug.js +0 -47
  35. package/dist/src/debug.js.map +0 -1
  36. package/dist/src/default/bullets.d.ts +0 -4
  37. package/dist/src/default/bullets.js +0 -39
  38. package/dist/src/default/bullets.js.map +0 -1
  39. package/dist/src/default/code.d.ts +0 -6
  40. package/dist/src/default/code.js +0 -13
  41. package/dist/src/default/code.js.map +0 -1
  42. package/dist/src/default/default.d.ts +0 -2
  43. package/dist/src/default/default.js +0 -20
  44. package/dist/src/default/default.js.map +0 -1
  45. package/dist/src/default/headings.d.ts +0 -20
  46. package/dist/src/default/headings.js +0 -125
  47. package/dist/src/default/headings.js.map +0 -1
  48. package/dist/src/default/html-renderer.d.ts +0 -26
  49. package/dist/src/default/html-renderer.js +0 -108
  50. package/dist/src/default/html-renderer.js.map +0 -1
  51. package/dist/src/default/inline-styles.d.ts +0 -4
  52. package/dist/src/default/inline-styles.js +0 -24
  53. package/dist/src/default/inline-styles.js.map +0 -1
  54. package/dist/src/default/misc.d.ts +0 -6
  55. package/dist/src/default/misc.js +0 -112
  56. package/dist/src/default/misc.js.map +0 -1
  57. package/dist/src/default/notes.d.ts +0 -28
  58. package/dist/src/default/notes.js +0 -109
  59. package/dist/src/default/notes.js.map +0 -1
  60. package/dist/src/default/quotes.d.ts +0 -4
  61. package/dist/src/default/quotes.js +0 -36
  62. package/dist/src/default/quotes.js.map +0 -1
  63. package/dist/src/default/vars.d.ts +0 -2
  64. package/dist/src/default/vars.js +0 -39
  65. package/dist/src/default/vars.js.map +0 -1
  66. package/dist/src/index.d.ts +0 -13
  67. package/dist/src/index.js +0 -58
  68. package/dist/src/index.js.map +0 -1
  69. package/dist/src/interface.d.ts +0 -174
  70. package/dist/src/interface.js +0 -93
  71. package/dist/src/interface.js.map +0 -1
  72. package/dist/src/messages.d.ts +0 -165
  73. package/dist/src/messages.js +0 -279
  74. package/dist/src/messages.js.map +0 -1
  75. package/dist/src/modifier-helper.d.ts +0 -6
  76. package/dist/src/modifier-helper.js +0 -113
  77. package/dist/src/modifier-helper.js.map +0 -1
  78. package/dist/src/parser-config.d.ts +0 -44
  79. package/dist/src/parser-config.js +0 -67
  80. package/dist/src/parser-config.js.map +0 -1
  81. package/dist/src/parser.d.ts +0 -3
  82. package/dist/src/parser.js +0 -652
  83. package/dist/src/parser.js.map +0 -1
  84. package/dist/src/renderer.d.ts +0 -49
  85. package/dist/src/renderer.js +0 -81
  86. package/dist/src/renderer.js.map +0 -1
  87. package/dist/src/scanner.d.ts +0 -22
  88. package/dist/src/scanner.js +0 -50
  89. package/dist/src/scanner.js.map +0 -1
  90. package/dist/src/temp.d.ts +0 -1
  91. package/dist/src/temp.js +0 -108
  92. package/dist/src/temp.js.map +0 -1
  93. package/dist/src/typing-helper.d.ts +0 -7
  94. package/dist/src/typing-helper.js +0 -3
  95. package/dist/src/typing-helper.js.map +0 -1
  96. package/dist/src/util.d.ts +0 -29
  97. package/dist/src/util.js +0 -177
  98. package/dist/src/util.js.map +0 -1
  99. package/dist/tests/advanced_syntax.test.d.ts +0 -1
  100. package/dist/tests/advanced_syntax.test.js +0 -180
  101. package/dist/tests/advanced_syntax.test.js.map +0 -1
  102. package/dist/tests/basic_syntax.test.d.ts +0 -1
  103. package/dist/tests/basic_syntax.test.js +0 -431
  104. package/dist/tests/basic_syntax.test.js.map +0 -1
  105. package/dist/tests/default/headings.test.d.ts +0 -1
  106. package/dist/tests/default/headings.test.js +0 -90
  107. package/dist/tests/default/headings.test.js.map +0 -1
  108. package/dist/tests/define_block.test.d.ts +0 -1
  109. package/dist/tests/define_block.test.js +0 -209
  110. package/dist/tests/define_block.test.js.map +0 -1
  111. package/dist/tests/define_inline.test.d.ts +0 -1
  112. package/dist/tests/define_inline.test.js +0 -289
  113. package/dist/tests/define_inline.test.js.map +0 -1
  114. package/dist/tests/modules.test.d.ts +0 -1
  115. package/dist/tests/modules.test.js +0 -137
  116. package/dist/tests/modules.test.js.map +0 -1
  117. package/dist/tests/shorthands.test.d.ts +0 -1
  118. package/dist/tests/shorthands.test.js +0 -79
  119. package/dist/tests/shorthands.test.js.map +0 -1
  120. package/dist/tsup.config.d.ts +0 -2
  121. package/dist/tsup.config.js +0 -12
  122. package/dist/tsup.config.js.map +0 -1
  123. package/dist/vitest.config.d.ts +0 -2
  124. package/dist/vitest.config.js +0 -17
  125. package/dist/vitest.config.js.map +0 -1
package/README.md CHANGED
@@ -83,9 +83,9 @@ You can also use the brackets without a modifier. However, this has little effec
83
83
  Suppose the modifier `[.pre]` accepts a preformatted block:
84
84
 
85
85
  ```
86
- [.pre] Preformatted content, suitable for code and ASCII art. Always treated as plain text, even if I write [.foo] or [/foo] or \[.
86
+ [.pre] This is preformatted content, suitable for code and ASCII art. Always treated as plain text, even if I write [.foo] or [/foo] or \[.
87
87
 
88
- However, like in a normal paragraph, a blank line creates a new block so this is no longer in the pre. Use brackets:
88
+ However, like in a normal paragraph, a blank line creates a new block so this is no longer in the pre. Use brackets if you don't want that:
89
89
 
90
90
  [.pre]
91
91
  :--
@@ -104,7 +104,7 @@ Use a `;` before `]` to signify empty content. Modifiers that don't accept conte
104
104
  [.pre;]
105
105
  ```
106
106
 
107
- In normal paragraphs, use a slash `\` to **escape** the character immediately after it, so that it will not be interpreted as a special character (e.g. the beginning of a modifier).
107
+ In normal paragraphs, you can use a backslash `\` to **escape** a character immediately after it, so that it will not be interpreted as a special character (e.g. the beginning of a modifier).
108
108
 
109
109
  **Inline modifiers** are similar to block modifiers, but occur in paragraphs. They are written as `[/baa]` or `[/baa args]`. If accepting content, use `[;]` to mark the end of their scope.
110
110
 
@@ -159,10 +159,10 @@ A colon before the first argument states explicitly the beginning of that argume
159
159
 
160
160
  ### System modifiers
161
161
 
162
- [**-define-block** *name*:*args...*]
163
- [**-define-block** *name*:*args...*:(*slot*)]
164
- [**-define-inline** *name*:*args...*]
165
- [**-define-inline** *name*:*args...*:(*slot*)]
162
+ [**-define-block** *name*:*args...*] *content*
163
+ [**-define-block** *name*:*args...*:(*slot*)] *content*
164
+ [**-define-inline** *name*:*args...*] *content*
165
+ [**-define-inline** *name*:*args...*:(*slot*)] *content*
166
166
 
167
167
  > Define a new modifier. The first argument is the name. If one or more arguments exist, and the last is enclosed in `()`, it is taken as the **slot name** (more on that later). The rest in the middle are names for the arguments.
168
168
  >
@@ -174,15 +174,15 @@ A colon before the first argument states explicitly the beginning of that argume
174
174
  >
175
175
  > You can't reassign arguments, only variables. Since arguments always take precedence over variables, "reassigning" them has no effect inside a definition and can only confuse the rest of the code.
176
176
 
177
- [**-define-block-prefix** *prefix*]
178
- [**-define-block-prefix** *prefix*:(*slot*)]
177
+ [**-define-block-prefix** *prefix*] *content*
178
+ [**-define-block-prefix** *prefix*:(*slot*)] *content*
179
179
 
180
180
  > Not implemented yet
181
181
 
182
- [**-define-inline-shorthand** *prefix*]
183
- [**-define-inline-shorthand** *prefix*:(*slot*):*postfix*]
184
- [**-define-inline-shorthand** *prefix*:*arg1*:*mid1*:*arg2*:*mid2*...]
185
- [**-define-inline-shorthand** *prefix*:*arg1*:*mid1*:*arg2*:*mid2*...:(*slot*):*postfix*]
182
+ [**-define-inline-shorthand** *prefix*] *content*
183
+ [**-define-inline-shorthand** *prefix*:(*slot*):*postfix*] *content*
184
+ [**-define-inline-shorthand** *prefix*:*arg1*:*mid1*:*arg2*:*mid2*...] *content*
185
+ [**-define-inline-shorthand** *prefix*:*arg1*:*mid1*:*arg2*:*mid2*...:(*slot*):*postfix*] *content*
186
186
 
187
187
  > Defines an inline shorthand. A shorthand notation consists of a prefix, zero or more pairs of argument and middle part, and optionally a slot and a postfix. You must specify a slot name if you want to use one, although you can specify an empty one using `()`. You may also specify an *empty* last argument, i.e. a `:` before the `]` that ends the modifier head, to make the postfix stand out better.
188
188
  > ```
@@ -222,14 +222,22 @@ A colon before the first argument states explicitly the beginning of that argume
222
222
  > ```
223
223
  > Note the first, unnamed `.slot` refers to the slot of `q`.
224
224
 
225
- [**.module** *module-name*]
225
+ [**.module** *module-name*] *content*
226
226
 
227
227
  > Causes the definitions in the content to become part of a **module**. They don't take effect outside the `[.module]` modifier *unless* activated by a `[.use]` or `[-use]` modifier.
228
228
 
229
- [**.use** *module-name*]
229
+ [**.use** *module-name*] *content*
230
230
 
231
231
  > Activates the definitions in a module for the content *within this modifier*. Use `[-use]` to activate for the whole document instead.
232
232
 
233
+ [**.ifdef** *id*] *content*
234
+
235
+ > Expands to the content if the variable or argument *id* is defined, or nothing if it's not.
236
+
237
+ [**.ifndef** *id*] *content*
238
+
239
+ > Expands to the content if the variable or argument *id* is undefined, or nothing if it's defined.
240
+
233
241
  ### Inline modifiers
234
242
 
235
243
  [**/slot**]
@@ -245,6 +253,11 @@ A colon before the first argument states explicitly the beginning of that argume
245
253
 
246
254
  > Expands to the value of the arguments, separated by nothing, as plain text.
247
255
 
256
+ [**/ifdef** *id*] *content* [;]
257
+ [**/ifndef** *id*] *content* [;]
258
+
259
+ > See the similarly named block modifiers.
260
+
248
261
  ### Interpolators
249
262
 
250
263
  **$(** *varid* **)**
package/dist/index.d.mts CHANGED
@@ -1,3 +1,5 @@
1
+ import * as minimal_jsx_runtime from 'minimal-jsx-runtime';
2
+
1
3
  declare enum DebugLevel {
2
4
  Trace = 0,
3
5
  Info = 1,
@@ -6,6 +8,35 @@ declare enum DebugLevel {
6
8
  None = 4
7
9
  }
8
10
 
11
+ type SourceDescriptor = {
12
+ readonly name: string;
13
+ };
14
+ interface Source extends SourceDescriptor {
15
+ readonly nLines: number;
16
+ /**
17
+ * Return the row- and column-index corresponding to a given location. The indices are zero-based.
18
+ */
19
+ getRowCol(loc: number): [row: number, col: number];
20
+ /**
21
+ * Returns the position of the start of row `n` (zero-based). If `n` is zero, returns zero. If the source contains less than `n` rows, returns `Infinity`.
22
+ */
23
+ getRowStart(n: number): number;
24
+ /**
25
+ * Returns the content of the row `n` (zero-based). If the source contains less than `n` rows, returns `undefined`.
26
+ */
27
+ getRow(n: number): string | undefined;
28
+ }
29
+ declare class StringSource implements Source {
30
+ private readonly src;
31
+ readonly name: string;
32
+ readonly nLines: number;
33
+ private readonly lineMap;
34
+ constructor(d: SourceDescriptor, src: string);
35
+ getRowCol(pos: number): [row: number, col: number];
36
+ getRowStart(n: number): number;
37
+ getRow(n: number): string | undefined;
38
+ }
39
+
9
40
  declare class NameManager<T extends {
10
41
  name: string;
11
42
  }> {
@@ -37,12 +68,20 @@ declare class ParseContext {
37
68
  set<S extends ParseContextStoreKey>(key: S, obj: ParseContextStoreEntry<S>): void;
38
69
  get<S extends ParseContextStoreKey>(key: S): ParseContextStoreEntry<S>;
39
70
  }
40
- declare class Document {
71
+ declare class Document$1 {
41
72
  readonly root: RootNode;
42
73
  readonly context: ParseContext;
43
74
  readonly messages: readonly Message[];
44
75
  constructor(root: RootNode, context: ParseContext, messages: readonly Message[]);
45
- toStripped(): Document;
76
+ toStripped(): Document$1;
77
+ /**
78
+ * Performs a depth-first walk of the node tree.
79
+ */
80
+ walk(callback: (node: BlockEntity | InlineEntity | ArgumentEntity) => 'skip' | 'break' | 'continue'): void;
81
+ /**
82
+ * Gets all nodes that covers the given position, from outermost to innermost (essentially a path).
83
+ */
84
+ resolvePosition(pos: number): (BlockEntity | InlineEntity | ArgumentEntity)[];
46
85
  }
47
86
  interface ReadonlyConfiguration {
48
87
  readonly initializers: readonly ((cxt: ParseContext) => void)[];
@@ -77,12 +116,9 @@ type Message = {
77
116
  readonly info: string;
78
117
  readonly code: number;
79
118
  };
80
- type SourceDescriptor = {
81
- name: string;
82
- };
83
119
  type LocationRange = {
84
120
  original?: LocationRange;
85
- source: SourceDescriptor;
121
+ source: Source;
86
122
  start: number;
87
123
  end: number;
88
124
  actualEnd?: number;
@@ -155,7 +191,7 @@ type InlineModifierNode<TState> = {
155
191
  type RootNode = {
156
192
  type: NodeType.Root;
157
193
  content: BlockEntity[];
158
- source: SourceDescriptor;
194
+ source: Source;
159
195
  };
160
196
  type ModifierNode<T = any> = BlockModifierNode<T> | InlineModifierNode<T> | SystemModifierNode<T>;
161
197
  type BlockEntity = ParagraphNode | PreNode | BlockModifierNode<any> | SystemModifierNode<any>;
@@ -185,24 +221,43 @@ declare class ModifierBase<TNode, TEntity> {
185
221
  readonly name: string;
186
222
  readonly slotType: ModifierSlotType;
187
223
  constructor(name: string, slotType?: ModifierSlotType, args?: Partial<ModifierBase<TNode, TEntity>>);
224
+ /**
225
+ * Common values: heading, emphasis, keyword, highlight, commentary, comment, link, quote
226
+ */
188
227
  roleHint?: string;
189
228
  /**
190
- * If true, any modifier encountered in the content of it will *not* be expanded, *unless* that modifier is `alwaysTryExpand`.
229
+ * If true, any modifier encountered inside it will *not* be expanded *during parse-content*,
230
+ * *unless* that modifier is `alwaysTryExpand`. In the vast majority of cases, you shouldn't
231
+ * be using this.
191
232
  */
192
233
  delayContentExpansion: boolean;
193
234
  /**
194
- * If true, such a modifier will always be expanded whenever it is encountered, *even if* contained in a modifier with `delayContentExpansion`.
235
+ * If true, such a modifier will always be expanded whenever it is encountered, *even if*
236
+ * it is contained in a modifier with `delayContentExpansion`. In the vast majority of cases,
237
+ * you shouldn't be using this.
195
238
  */
196
239
  alwaysTryExpand: boolean;
197
- /** Called before the modifier's content is parsed. */
240
+ /** Called before the modifier's content is parsed.
241
+ * @param immediate False when the node is inside a `delayContentExpansion` modifier, but it is `alwaysTryExpand`; otherwise true.
242
+ */
198
243
  beforeParseContent?: (node: TNode, cxt: ParseContext, immediate: boolean) => Message[];
199
- /** Called after the modifier's content is parsed. */
244
+ /** Called after the modifier's content is parsed.
245
+ * @param immediate False when the node is inside a `delayContentExpansion` modifier, but it is `alwaysTryExpand`; otherwise true.
246
+ */
200
247
  afterParseContent?: (node: TNode, cxt: ParseContext, immediate: boolean) => Message[];
201
- /** Called before reparsing of the expansion. */
248
+ /** Called before reparsing of the expansion.
249
+ * @param immediate False when the node is inside a `delayContentExpansion` modifier, but it is `alwaysTryExpand`; otherwise true.*/
202
250
  beforeProcessExpansion?: (node: TNode, cxt: ParseContext, immediate: boolean) => Message[];
203
- /** Called before reparsing of the expansion. */
251
+ /** Called before reparsing of the expansion.
252
+ * @param immediate False when the node is inside a `delayContentExpansion` modifier, but it is `alwaysTryExpand`; otherwise true.*/
204
253
  afterProcessExpansion?: (node: TNode, cxt: ParseContext, immediate: boolean) => Message[];
254
+ /**
255
+ * @param immediate False when the node is inside a `delayContentExpansion` modifier, but it is `alwaysTryExpand`; otherwise true.
256
+ */
205
257
  prepareExpand?: (node: TNode, cxt: ParseContext, immediate: boolean) => Message[];
258
+ /**
259
+ * @param immediate False when the node is inside a `delayContentExpansion` modifier, but it is `alwaysTryExpand`; otherwise true.
260
+ */
206
261
  expand?: (node: TNode, cxt: ParseContext, immediate: boolean) => TEntity[] | undefined;
207
262
  }
208
263
  declare class BlockModifierDefinition<TState> extends ModifierBase<BlockModifierNode<TState>, BlockEntity> {
@@ -229,9 +284,9 @@ type InlineShorthand<TState> = Shorthand<InlineModifierDefinition<TState>>;
229
284
 
230
285
  declare class SimpleScanner implements Scanner {
231
286
  private src;
232
- readonly source: SourceDescriptor;
287
+ readonly source: Source;
233
288
  private pos;
234
- constructor(src: string, source?: SourceDescriptor);
289
+ constructor(src: string, sourceDesc?: SourceDescriptor);
235
290
  position(): number;
236
291
  isEOF(): boolean;
237
292
  peek(str: string): boolean;
@@ -240,7 +295,7 @@ declare class SimpleScanner implements Scanner {
240
295
  acceptWhitespaceChar(): string | null;
241
296
  }
242
297
  interface Scanner {
243
- readonly source: SourceDescriptor;
298
+ readonly source: Source;
244
299
  position(): number;
245
300
  isEOF(): boolean;
246
301
  peek(str: string): boolean;
@@ -249,25 +304,30 @@ interface Scanner {
249
304
  acceptWhitespaceChar(): string | null;
250
305
  }
251
306
 
252
- declare function parse(scanner: Scanner, cxt: ParseContext): Document;
307
+ declare function parse(scanner: Scanner, cxt: ParseContext): Document$1;
253
308
 
254
- type RendererType<TState, TReturn, TOptions = undefined> = {
309
+ type RendererType<TState, TReturn, TDocument, TOptions = undefined> = {
255
310
  state: TState;
256
311
  return: TReturn;
312
+ document: TDocument;
257
313
  options: TOptions;
258
314
  };
259
- type AnyRendererType = RendererType<any, any, any>;
260
- type getState<Type> = Type extends RendererType<infer T, any, any> ? T : never;
261
- type getReturn<Type> = Type extends RendererType<any, infer T, any> ? T : never;
262
- type getOptions<Type> = Type extends RendererType<any, any, infer T> ? T : never;
315
+ type AnyRendererType = RendererType<any, any, any, any>;
316
+ type getState<Type> = Type extends RendererType<infer T, any, any, any> ? T : never;
317
+ type getReturn<Type> = Type extends RendererType<any, infer T, any, any> ? T : never;
318
+ type getDocument<Type> = Type extends RendererType<any, any, infer T, any> ? T : never;
319
+ type getOptions<Type> = Type extends RendererType<any, any, any, infer T> ? T : never;
263
320
  type NodeRenderer<Type extends AnyRendererType, TNode> = (node: TNode, cxt: RenderContext<Type>) => getReturn<Type>;
264
- type NodeRendererDefinition<Type extends AnyRendererType, TNode, TDef> = [def: TDef, renderer: NodeRenderer<Type, TNode>];
321
+ type NodeRendererDefinition<Type extends AnyRendererType, TNode, TDef> = [
322
+ def: TDef,
323
+ renderer: NodeRenderer<Type, TNode>
324
+ ];
265
325
  declare class RenderContext<Type extends AnyRendererType> {
266
326
  readonly config: RenderConfiguration<Type>;
267
- readonly parseContext: ParseContext;
327
+ readonly parsedDocument: Document$1;
268
328
  state: getState<Type>;
269
329
  renderEntity(node: BlockEntity | InlineEntity): getReturn<Type> | undefined;
270
- constructor(config: RenderConfiguration<Type>, parseContext: ParseContext, state: getState<Type>);
330
+ constructor(config: RenderConfiguration<Type>, parsedDocument: Document$1, state: getState<Type>);
271
331
  }
272
332
  interface ReadonlyRenderConfiguration<Type extends AnyRendererType> {
273
333
  readonly options: getOptions<Type>;
@@ -277,22 +337,22 @@ interface ReadonlyRenderConfiguration<Type extends AnyRendererType> {
277
337
  readonly undefinedInlineRenderer?: NodeRenderer<Type, InlineModifierNode<any>>;
278
338
  readonly blockRenderers: ReadonlyMap<BlockModifierDefinition<any>, NodeRenderer<Type, BlockModifierNode<any>>>;
279
339
  readonly inlineRenderers: ReadonlyMap<InlineModifierDefinition<any>, NodeRenderer<Type, InlineModifierNode<any>>>;
280
- readonly postprocessor: (results: getReturn<Type>[], cxt: RenderContext<Type>) => getReturn<Type>;
281
- render(doc: Document, state: getState<Type>): getReturn<Type>;
340
+ readonly postprocessor: (results: getReturn<Type>[], cxt: RenderContext<Type>) => getDocument<Type>;
341
+ render(doc: Document$1, state: getState<Type>): getDocument<Type>;
282
342
  }
283
343
  type BlockRendererDefiniton<Type extends AnyRendererType, ModState = any> = NodeRendererDefinition<Type, BlockModifierNode<ModState>, BlockModifierDefinition<ModState>>;
284
344
  type InlineRendererDefiniton<Type extends AnyRendererType, ModState = any> = NodeRendererDefinition<Type, InlineModifierNode<ModState>, InlineModifierDefinition<ModState>>;
285
345
  declare class RenderConfiguration<Type extends AnyRendererType> implements ReadonlyRenderConfiguration<Type> {
286
346
  options: getOptions<Type>;
287
- postprocessor: (results: getReturn<Type>[], cxt: RenderContext<Type>) => getReturn<Type>;
347
+ postprocessor: (results: getReturn<Type>[], cxt: RenderContext<Type>) => getDocument<Type>;
288
348
  paragraphRenderer?: NodeRenderer<Type, ParagraphNode>;
289
349
  textRenderer?: NodeRenderer<Type, TextNode | PreNode | EscapedNode>;
290
350
  undefinedBlockRenderer?: NodeRenderer<Type, BlockModifierNode<any>>;
291
351
  undefinedInlineRenderer?: NodeRenderer<Type, InlineModifierNode<any>>;
292
352
  blockRenderers: Map<BlockModifierDefinition<any>, NodeRenderer<Type, BlockModifierNode<any>>>;
293
353
  inlineRenderers: Map<InlineModifierDefinition<any>, NodeRenderer<Type, InlineModifierNode<any>>>;
294
- constructor(options: getOptions<Type>, postprocessor: (results: getReturn<Type>[], cxt: RenderContext<Type>) => getReturn<Type>);
295
- render(doc: Document, state: getState<Type>): getReturn<Type>;
354
+ constructor(options: getOptions<Type>, postprocessor: (results: getReturn<Type>[], cxt: RenderContext<Type>) => getDocument<Type>);
355
+ render(doc: Document$1, state: getState<Type>): getDocument<Type>;
296
356
  addBlockRenderer(...rs: BlockRendererDefiniton<Type>[]): void;
297
357
  addInlineRenderer(...rs: InlineRendererDefiniton<Type>[]): void;
298
358
  static from<Type extends AnyRendererType>(from: ReadonlyRenderConfiguration<Type>): RenderConfiguration<Type>;
@@ -425,7 +485,7 @@ declare class UnnecessaryNewlineMessage extends RemoveThingMessage {
425
485
  declare class NewBlockShouldBeOnNewlineMessage extends AddThingMessage {
426
486
  constructor(location: LocationRange);
427
487
  }
428
- declare class ContentShouldBeOnNewlineMessage extends AddThingMessage {
488
+ declare class ShouldBeOnNewlineMessage extends AddThingMessage {
429
489
  constructor(location: LocationRange);
430
490
  }
431
491
  declare class NameAlreadyDefinedMessage implements Message {
@@ -468,8 +528,6 @@ type messages_CannotExpandArgumentMessage = CannotExpandArgumentMessage;
468
528
  declare const messages_CannotExpandArgumentMessage: typeof CannotExpandArgumentMessage;
469
529
  type messages_CannotUseModuleInSelfMessage = CannotUseModuleInSelfMessage;
470
530
  declare const messages_CannotUseModuleInSelfMessage: typeof CannotUseModuleInSelfMessage;
471
- type messages_ContentShouldBeOnNewlineMessage = ContentShouldBeOnNewlineMessage;
472
- declare const messages_ContentShouldBeOnNewlineMessage: typeof ContentShouldBeOnNewlineMessage;
473
531
  type messages_EitherNormalOrPreMessage = EitherNormalOrPreMessage;
474
532
  declare const messages_EitherNormalOrPreMessage: typeof EitherNormalOrPreMessage;
475
533
  type messages_EntityNotAllowedMessage = EntityNotAllowedMessage;
@@ -494,6 +552,8 @@ type messages_OverwriteSpecialVariableMessage = OverwriteSpecialVariableMessage;
494
552
  declare const messages_OverwriteSpecialVariableMessage: typeof OverwriteSpecialVariableMessage;
495
553
  type messages_ReachedRecursionLimitMessage = ReachedRecursionLimitMessage;
496
554
  declare const messages_ReachedRecursionLimitMessage: typeof ReachedRecursionLimitMessage;
555
+ type messages_ShouldBeOnNewlineMessage = ShouldBeOnNewlineMessage;
556
+ declare const messages_ShouldBeOnNewlineMessage: typeof ShouldBeOnNewlineMessage;
497
557
  type messages_SlotUsedOutsideDefinitionMessage = SlotUsedOutsideDefinitionMessage;
498
558
  declare const messages_SlotUsedOutsideDefinitionMessage: typeof SlotUsedOutsideDefinitionMessage;
499
559
  type messages_UnclosedInlineModifierMessage = UnclosedInlineModifierMessage;
@@ -505,7 +565,22 @@ declare const messages_UnknownModifierMessage: typeof UnknownModifierMessage;
505
565
  type messages_UnnecessaryNewlineMessage = UnnecessaryNewlineMessage;
506
566
  declare const messages_UnnecessaryNewlineMessage: typeof UnnecessaryNewlineMessage;
507
567
  declare namespace messages {
508
- export { messages_ArgumentCountMismatchMessage as ArgumentCountMismatchMessage, messages_CannotExpandArgumentMessage as CannotExpandArgumentMessage, messages_CannotUseModuleInSelfMessage as CannotUseModuleInSelfMessage, messages_ContentShouldBeOnNewlineMessage as ContentShouldBeOnNewlineMessage, messages_EitherNormalOrPreMessage as EitherNormalOrPreMessage, messages_EntityNotAllowedMessage as EntityNotAllowedMessage, messages_ExpectedMessage as ExpectedMessage, messages_InvalidArgumentMessage as InvalidArgumentMessage, messages_MultipleBlocksNotPermittedMessage as MultipleBlocksNotPermittedMessage, messages_NameAlreadyDefinedMessage as NameAlreadyDefinedMessage, messages_NewBlockShouldBeOnNewlineMessage as NewBlockShouldBeOnNewlineMessage, messages_NoNestedModuleMessage as NoNestedModuleMessage, messages_OnlySimpleParagraphsPermittedMessage as OnlySimpleParagraphsPermittedMessage, messages_OverwriteDefinitionsMessage as OverwriteDefinitionsMessage, messages_OverwriteSpecialVariableMessage as OverwriteSpecialVariableMessage, messages_ReachedRecursionLimitMessage as ReachedRecursionLimitMessage, messages_SlotUsedOutsideDefinitionMessage as SlotUsedOutsideDefinitionMessage, messages_UnclosedInlineModifierMessage as UnclosedInlineModifierMessage, messages_UndefinedVariableMessage as UndefinedVariableMessage, messages_UnknownModifierMessage as UnknownModifierMessage, messages_UnnecessaryNewlineMessage as UnnecessaryNewlineMessage };
568
+ export { messages_ArgumentCountMismatchMessage as ArgumentCountMismatchMessage, messages_CannotExpandArgumentMessage as CannotExpandArgumentMessage, messages_CannotUseModuleInSelfMessage as CannotUseModuleInSelfMessage, messages_EitherNormalOrPreMessage as EitherNormalOrPreMessage, messages_EntityNotAllowedMessage as EntityNotAllowedMessage, messages_ExpectedMessage as ExpectedMessage, messages_InvalidArgumentMessage as InvalidArgumentMessage, messages_MultipleBlocksNotPermittedMessage as MultipleBlocksNotPermittedMessage, messages_NameAlreadyDefinedMessage as NameAlreadyDefinedMessage, messages_NewBlockShouldBeOnNewlineMessage as NewBlockShouldBeOnNewlineMessage, messages_NoNestedModuleMessage as NoNestedModuleMessage, messages_OnlySimpleParagraphsPermittedMessage as OnlySimpleParagraphsPermittedMessage, messages_OverwriteDefinitionsMessage as OverwriteDefinitionsMessage, messages_OverwriteSpecialVariableMessage as OverwriteSpecialVariableMessage, messages_ReachedRecursionLimitMessage as ReachedRecursionLimitMessage, messages_ShouldBeOnNewlineMessage as ShouldBeOnNewlineMessage, messages_SlotUsedOutsideDefinitionMessage as SlotUsedOutsideDefinitionMessage, messages_UnclosedInlineModifierMessage as UnclosedInlineModifierMessage, messages_UndefinedVariableMessage as UndefinedVariableMessage, messages_UnknownModifierMessage as UnknownModifierMessage, messages_UnnecessaryNewlineMessage as UnnecessaryNewlineMessage };
569
+ }
570
+
571
+ declare function checkArgumentLength(node: ModifierNode, min?: number, max?: number | undefined): Message[] | null;
572
+ declare function checkArguments(node: ModifierNode, min?: number, max?: number | undefined): Message[] | null;
573
+ declare function onlyPermitPlaintextParagraph(node: BlockModifierNode<any> | SystemModifierNode<any>): Message[] | string;
574
+ declare function onlyPermitSimpleParagraphs(node: BlockModifierNode<any> | SystemModifierNode<any>): Message[] | null;
575
+ declare function onlyPermitSingleBlock(node: BlockModifierNode<any> | SystemModifierNode<any>): Message[] | null;
576
+
577
+ declare const modifierHelper_checkArgumentLength: typeof checkArgumentLength;
578
+ declare const modifierHelper_checkArguments: typeof checkArguments;
579
+ declare const modifierHelper_onlyPermitPlaintextParagraph: typeof onlyPermitPlaintextParagraph;
580
+ declare const modifierHelper_onlyPermitSimpleParagraphs: typeof onlyPermitSimpleParagraphs;
581
+ declare const modifierHelper_onlyPermitSingleBlock: typeof onlyPermitSingleBlock;
582
+ declare namespace modifierHelper {
583
+ export { modifierHelper_checkArgumentLength as checkArgumentLength, modifierHelper_checkArguments as checkArguments, modifierHelper_onlyPermitPlaintextParagraph as onlyPermitPlaintextParagraph, modifierHelper_onlyPermitSimpleParagraphs as onlyPermitSimpleParagraphs, modifierHelper_onlyPermitSingleBlock as onlyPermitSingleBlock };
509
584
  }
510
585
 
511
586
  declare const BuiltinConfiguration: ReadonlyConfiguration;
@@ -516,24 +591,25 @@ type HTMLRendererOptions = {
516
591
  headPlugins: HTMLComponentPlugin[];
517
592
  headerPlugins: HTMLComponentPlugin[];
518
593
  footerPlugins: HTMLComponentPlugin[];
594
+ postprocessPlugins: HTMLPostprocessPlugin[];
519
595
  transformAsset: (id: string) => string | undefined;
520
596
  };
521
597
  type HTMLRenderType = {
522
598
  state: HTMLRenderState;
523
599
  options: HTMLRendererOptions;
524
- return: string;
600
+ document: Document;
601
+ return: Node | Node[];
525
602
  };
526
603
  type HTMLRenderPlugin = (elem: BlockEntity | InlineEntity, cxt: RenderContext<HTMLRenderType>) => string | undefined;
527
- type HTMLComponentPlugin = (cxt: RenderContext<HTMLRenderType>) => string | undefined;
528
- type HTMLPostprocessPlugin = (cxt: RenderContext<HTMLRenderType>, output: string) => string;
604
+ type HTMLComponentPlugin = (cxt: RenderContext<HTMLRenderType>) => Node | Node[] | undefined;
605
+ type HTMLPostprocessPlugin = (cxt: RenderContext<HTMLRenderType>, output: Document) => void;
529
606
  declare class HTMLRenderState {
530
607
  title: string;
531
608
  stylesheet: string;
532
609
  cssVariables: Map<string, string>;
533
- escape(content: string): string;
534
- invalidBlock(node: BlockEntity, msg: string): string;
535
- invalidInline(node: InlineEntity, msg: string): string;
536
- render(elems: (BlockEntity | InlineEntity)[], cxt: RenderContext<HTMLRenderType>): string;
610
+ invalidBlock(node: BlockEntity, msg: string): minimal_jsx_runtime.JSX.Element;
611
+ invalidInline(node: InlineEntity, msg: string): minimal_jsx_runtime.JSX.Element;
612
+ render(elems: (BlockEntity | InlineEntity)[], cxt: RenderContext<HTMLRenderType>): DocumentFragment;
537
613
  }
538
614
  declare const HTMLRenderConfiguration: ReadonlyRenderConfiguration<HTMLRenderType>;
539
615
 
@@ -544,11 +620,15 @@ declare const debugPrint: {
544
620
  blockShorthand: (x: BlockShorthand<any>) => string;
545
621
  argument: (arg: ModifierArgument) => string;
546
622
  node: (...nodes: (BlockEntity | InlineEntity)[]) => string;
547
- message: (m: Message, source?: string, descriptor?: SourceDescriptor) => string;
623
+ message: typeof debugPrintMsg;
624
+ range: typeof debugPrintRange;
548
625
  document: typeof debugDumpDocument;
549
626
  };
550
- declare function debugDumpDocument(doc: Document, source: string): string;
627
+ declare function debugPrintRange(loc: LocationRange, context?: number): string;
628
+ declare function debugPrintMsg(m: Message): string;
629
+ declare function debugDumpDocument(doc: Document$1): string;
551
630
 
631
+ declare const emmmVersion = "0.0.6";
552
632
  declare function setDebugLevel(level: DebugLevel): void;
553
633
 
554
- export { type ArgumentEntity, ArgumentInterpolatorDefinition, type BlockEntity, BlockModifierDefinition, type BlockModifierNode, type BlockRendererDefiniton, type BlockShorthand, BuiltinConfiguration, Configuration, DebugLevel, DefaultConfiguration, Document, type DocumentNode, type EscapedNode, type HTMLComponentPlugin, type HTMLPostprocessPlugin, HTMLRenderConfiguration, type HTMLRenderPlugin, HTMLRenderState, type HTMLRenderType, type HTMLRendererOptions, type InlineEntity, InlineModifierDefinition, type InlineModifierNode, type InlineRendererDefiniton, type InlineShorthand, type InterpolationNode, type LocationRange, type Message, MessageSeverity, type ModifierArgument, type ModifierNode, ModifierSlotType, type NodeRenderer, type NodeRendererDefinition, NodeType, type ParagraphNode, ParseContext, type ParseContextStoreDefinitions, type ParseContextStoreKey, type PreNode, type ReadonlyConfiguration, type ReadonlyRenderConfiguration, RenderConfiguration, RenderContext, type RendererType, type RootNode, type Scanner, SimpleScanner, type SourceDescriptor, SystemModifierDefinition, type SystemModifierNode, type TextNode, debugPrint, messages, parse, setDebugLevel };
634
+ export { type ArgumentEntity, ArgumentInterpolatorDefinition, type BlockEntity, BlockModifierDefinition, type BlockModifierNode, type BlockRendererDefiniton, type BlockShorthand, BuiltinConfiguration, Configuration, DebugLevel, DefaultConfiguration, Document$1 as Document, type DocumentNode, type EscapedNode, type HTMLComponentPlugin, type HTMLPostprocessPlugin, HTMLRenderConfiguration, type HTMLRenderPlugin, HTMLRenderState, type HTMLRenderType, type HTMLRendererOptions, type InlineEntity, InlineModifierDefinition, type InlineModifierNode, type InlineRendererDefiniton, type InlineShorthand, type InterpolationNode, type LocationRange, type Message, MessageSeverity, type ModifierArgument, type ModifierNode, ModifierSlotType, type NodeRenderer, type NodeRendererDefinition, NodeType, type ParagraphNode, ParseContext, type ParseContextStoreDefinitions, type ParseContextStoreKey, type PreNode, type ReadonlyConfiguration, type ReadonlyRenderConfiguration, RenderConfiguration, RenderContext, type RendererType, type RootNode, type Scanner, SimpleScanner, type Source, type SourceDescriptor, StringSource, SystemModifierDefinition, type SystemModifierNode, type TextNode, debugPrint, emmmVersion, modifierHelper as helper, messages, parse, setDebugLevel };