@the_dissidents/libemmm 0.0.7 → 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.
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,
@@ -16,13 +18,13 @@ interface Source extends SourceDescriptor {
16
18
  */
17
19
  getRowCol(loc: number): [row: number, col: number];
18
20
  /**
19
- * Returns the position of the start of line `n` (zero-based). If `n` is zero, returns zero. If the source contains less than `n` lines, returns `Infinity`.
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`.
20
22
  */
21
- getLineStart(n: number): number;
23
+ getRowStart(n: number): number;
22
24
  /**
23
- * Returns the content line `n`. If the source contains less than `n` lines, returns `Infinity`.
25
+ * Returns the content of the row `n` (zero-based). If the source contains less than `n` rows, returns `undefined`.
24
26
  */
25
- getLine(n: number): string | undefined;
27
+ getRow(n: number): string | undefined;
26
28
  }
27
29
  declare class StringSource implements Source {
28
30
  private readonly src;
@@ -31,8 +33,8 @@ declare class StringSource implements Source {
31
33
  private readonly lineMap;
32
34
  constructor(d: SourceDescriptor, src: string);
33
35
  getRowCol(pos: number): [row: number, col: number];
34
- getLineStart(n: number): number;
35
- getLine(n: number): string | undefined;
36
+ getRowStart(n: number): number;
37
+ getRow(n: number): string | undefined;
36
38
  }
37
39
 
38
40
  declare class NameManager<T extends {
@@ -66,12 +68,12 @@ declare class ParseContext {
66
68
  set<S extends ParseContextStoreKey>(key: S, obj: ParseContextStoreEntry<S>): void;
67
69
  get<S extends ParseContextStoreKey>(key: S): ParseContextStoreEntry<S>;
68
70
  }
69
- declare class Document {
71
+ declare class Document$1 {
70
72
  readonly root: RootNode;
71
73
  readonly context: ParseContext;
72
74
  readonly messages: readonly Message[];
73
75
  constructor(root: RootNode, context: ParseContext, messages: readonly Message[]);
74
- toStripped(): Document;
76
+ toStripped(): Document$1;
75
77
  /**
76
78
  * Performs a depth-first walk of the node tree.
77
79
  */
@@ -219,6 +221,9 @@ declare class ModifierBase<TNode, TEntity> {
219
221
  readonly name: string;
220
222
  readonly slotType: ModifierSlotType;
221
223
  constructor(name: string, slotType?: ModifierSlotType, args?: Partial<ModifierBase<TNode, TEntity>>);
224
+ /**
225
+ * Common values: heading, emphasis, keyword, highlight, commentary, comment, link, quote
226
+ */
222
227
  roleHint?: string;
223
228
  /**
224
229
  * If true, any modifier encountered inside it will *not* be expanded *during parse-content*,
@@ -228,7 +233,7 @@ declare class ModifierBase<TNode, TEntity> {
228
233
  delayContentExpansion: boolean;
229
234
  /**
230
235
  * If true, such a modifier will always be expanded whenever it is encountered, *even if*
231
- * contained in a modifier with `delayContentExpansion`. In the vast majority of cases,
236
+ * it is contained in a modifier with `delayContentExpansion`. In the vast majority of cases,
232
237
  * you shouldn't be using this.
233
238
  */
234
239
  alwaysTryExpand: boolean;
@@ -299,25 +304,30 @@ interface Scanner {
299
304
  acceptWhitespaceChar(): string | null;
300
305
  }
301
306
 
302
- declare function parse(scanner: Scanner, cxt: ParseContext): Document;
307
+ declare function parse(scanner: Scanner, cxt: ParseContext): Document$1;
303
308
 
304
- type RendererType<TState, TReturn, TOptions = undefined> = {
309
+ type RendererType<TState, TReturn, TDocument, TOptions = undefined> = {
305
310
  state: TState;
306
311
  return: TReturn;
312
+ document: TDocument;
307
313
  options: TOptions;
308
314
  };
309
- type AnyRendererType = RendererType<any, any, any>;
310
- type getState<Type> = Type extends RendererType<infer T, any, any> ? T : never;
311
- type getReturn<Type> = Type extends RendererType<any, infer T, any> ? T : never;
312
- 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;
313
320
  type NodeRenderer<Type extends AnyRendererType, TNode> = (node: TNode, cxt: RenderContext<Type>) => getReturn<Type>;
314
- 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
+ ];
315
325
  declare class RenderContext<Type extends AnyRendererType> {
316
326
  readonly config: RenderConfiguration<Type>;
317
- readonly parseContext: ParseContext;
327
+ readonly parsedDocument: Document$1;
318
328
  state: getState<Type>;
319
329
  renderEntity(node: BlockEntity | InlineEntity): getReturn<Type> | undefined;
320
- constructor(config: RenderConfiguration<Type>, parseContext: ParseContext, state: getState<Type>);
330
+ constructor(config: RenderConfiguration<Type>, parsedDocument: Document$1, state: getState<Type>);
321
331
  }
322
332
  interface ReadonlyRenderConfiguration<Type extends AnyRendererType> {
323
333
  readonly options: getOptions<Type>;
@@ -327,22 +337,22 @@ interface ReadonlyRenderConfiguration<Type extends AnyRendererType> {
327
337
  readonly undefinedInlineRenderer?: NodeRenderer<Type, InlineModifierNode<any>>;
328
338
  readonly blockRenderers: ReadonlyMap<BlockModifierDefinition<any>, NodeRenderer<Type, BlockModifierNode<any>>>;
329
339
  readonly inlineRenderers: ReadonlyMap<InlineModifierDefinition<any>, NodeRenderer<Type, InlineModifierNode<any>>>;
330
- readonly postprocessor: (results: getReturn<Type>[], cxt: RenderContext<Type>) => getReturn<Type>;
331
- 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>;
332
342
  }
333
343
  type BlockRendererDefiniton<Type extends AnyRendererType, ModState = any> = NodeRendererDefinition<Type, BlockModifierNode<ModState>, BlockModifierDefinition<ModState>>;
334
344
  type InlineRendererDefiniton<Type extends AnyRendererType, ModState = any> = NodeRendererDefinition<Type, InlineModifierNode<ModState>, InlineModifierDefinition<ModState>>;
335
345
  declare class RenderConfiguration<Type extends AnyRendererType> implements ReadonlyRenderConfiguration<Type> {
336
346
  options: getOptions<Type>;
337
- postprocessor: (results: getReturn<Type>[], cxt: RenderContext<Type>) => getReturn<Type>;
347
+ postprocessor: (results: getReturn<Type>[], cxt: RenderContext<Type>) => getDocument<Type>;
338
348
  paragraphRenderer?: NodeRenderer<Type, ParagraphNode>;
339
349
  textRenderer?: NodeRenderer<Type, TextNode | PreNode | EscapedNode>;
340
350
  undefinedBlockRenderer?: NodeRenderer<Type, BlockModifierNode<any>>;
341
351
  undefinedInlineRenderer?: NodeRenderer<Type, InlineModifierNode<any>>;
342
352
  blockRenderers: Map<BlockModifierDefinition<any>, NodeRenderer<Type, BlockModifierNode<any>>>;
343
353
  inlineRenderers: Map<InlineModifierDefinition<any>, NodeRenderer<Type, InlineModifierNode<any>>>;
344
- constructor(options: getOptions<Type>, postprocessor: (results: getReturn<Type>[], cxt: RenderContext<Type>) => getReturn<Type>);
345
- 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>;
346
356
  addBlockRenderer(...rs: BlockRendererDefiniton<Type>[]): void;
347
357
  addInlineRenderer(...rs: InlineRendererDefiniton<Type>[]): void;
348
358
  static from<Type extends AnyRendererType>(from: ReadonlyRenderConfiguration<Type>): RenderConfiguration<Type>;
@@ -558,6 +568,21 @@ declare namespace messages {
558
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 };
559
569
  }
560
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 };
584
+ }
585
+
561
586
  declare const BuiltinConfiguration: ReadonlyConfiguration;
562
587
 
563
588
  declare const DefaultConfiguration: ReadonlyConfiguration;
@@ -566,24 +591,25 @@ type HTMLRendererOptions = {
566
591
  headPlugins: HTMLComponentPlugin[];
567
592
  headerPlugins: HTMLComponentPlugin[];
568
593
  footerPlugins: HTMLComponentPlugin[];
594
+ postprocessPlugins: HTMLPostprocessPlugin[];
569
595
  transformAsset: (id: string) => string | undefined;
570
596
  };
571
597
  type HTMLRenderType = {
572
598
  state: HTMLRenderState;
573
599
  options: HTMLRendererOptions;
574
- return: string;
600
+ document: Document;
601
+ return: Node | Node[];
575
602
  };
576
603
  type HTMLRenderPlugin = (elem: BlockEntity | InlineEntity, cxt: RenderContext<HTMLRenderType>) => string | undefined;
577
- type HTMLComponentPlugin = (cxt: RenderContext<HTMLRenderType>) => string | undefined;
578
- 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;
579
606
  declare class HTMLRenderState {
580
607
  title: string;
581
608
  stylesheet: string;
582
609
  cssVariables: Map<string, string>;
583
- escape(content: string): string;
584
- invalidBlock(node: BlockEntity, msg: string): string;
585
- invalidInline(node: InlineEntity, msg: string): string;
586
- 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;
587
613
  }
588
614
  declare const HTMLRenderConfiguration: ReadonlyRenderConfiguration<HTMLRenderType>;
589
615
 
@@ -600,9 +626,9 @@ declare const debugPrint: {
600
626
  };
601
627
  declare function debugPrintRange(loc: LocationRange, context?: number): string;
602
628
  declare function debugPrintMsg(m: Message): string;
603
- declare function debugDumpDocument(doc: Document): string;
629
+ declare function debugDumpDocument(doc: Document$1): string;
604
630
 
605
631
  declare const emmmVersion = "0.0.6";
606
632
  declare function setDebugLevel(level: DebugLevel): void;
607
633
 
608
- 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 Source, type SourceDescriptor, StringSource, SystemModifierDefinition, type SystemModifierNode, type TextNode, debugPrint, emmmVersion, 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 };
package/dist/index.d.ts 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,
@@ -16,13 +18,13 @@ interface Source extends SourceDescriptor {
16
18
  */
17
19
  getRowCol(loc: number): [row: number, col: number];
18
20
  /**
19
- * Returns the position of the start of line `n` (zero-based). If `n` is zero, returns zero. If the source contains less than `n` lines, returns `Infinity`.
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`.
20
22
  */
21
- getLineStart(n: number): number;
23
+ getRowStart(n: number): number;
22
24
  /**
23
- * Returns the content line `n`. If the source contains less than `n` lines, returns `Infinity`.
25
+ * Returns the content of the row `n` (zero-based). If the source contains less than `n` rows, returns `undefined`.
24
26
  */
25
- getLine(n: number): string | undefined;
27
+ getRow(n: number): string | undefined;
26
28
  }
27
29
  declare class StringSource implements Source {
28
30
  private readonly src;
@@ -31,8 +33,8 @@ declare class StringSource implements Source {
31
33
  private readonly lineMap;
32
34
  constructor(d: SourceDescriptor, src: string);
33
35
  getRowCol(pos: number): [row: number, col: number];
34
- getLineStart(n: number): number;
35
- getLine(n: number): string | undefined;
36
+ getRowStart(n: number): number;
37
+ getRow(n: number): string | undefined;
36
38
  }
37
39
 
38
40
  declare class NameManager<T extends {
@@ -66,12 +68,12 @@ declare class ParseContext {
66
68
  set<S extends ParseContextStoreKey>(key: S, obj: ParseContextStoreEntry<S>): void;
67
69
  get<S extends ParseContextStoreKey>(key: S): ParseContextStoreEntry<S>;
68
70
  }
69
- declare class Document {
71
+ declare class Document$1 {
70
72
  readonly root: RootNode;
71
73
  readonly context: ParseContext;
72
74
  readonly messages: readonly Message[];
73
75
  constructor(root: RootNode, context: ParseContext, messages: readonly Message[]);
74
- toStripped(): Document;
76
+ toStripped(): Document$1;
75
77
  /**
76
78
  * Performs a depth-first walk of the node tree.
77
79
  */
@@ -219,6 +221,9 @@ declare class ModifierBase<TNode, TEntity> {
219
221
  readonly name: string;
220
222
  readonly slotType: ModifierSlotType;
221
223
  constructor(name: string, slotType?: ModifierSlotType, args?: Partial<ModifierBase<TNode, TEntity>>);
224
+ /**
225
+ * Common values: heading, emphasis, keyword, highlight, commentary, comment, link, quote
226
+ */
222
227
  roleHint?: string;
223
228
  /**
224
229
  * If true, any modifier encountered inside it will *not* be expanded *during parse-content*,
@@ -228,7 +233,7 @@ declare class ModifierBase<TNode, TEntity> {
228
233
  delayContentExpansion: boolean;
229
234
  /**
230
235
  * If true, such a modifier will always be expanded whenever it is encountered, *even if*
231
- * contained in a modifier with `delayContentExpansion`. In the vast majority of cases,
236
+ * it is contained in a modifier with `delayContentExpansion`. In the vast majority of cases,
232
237
  * you shouldn't be using this.
233
238
  */
234
239
  alwaysTryExpand: boolean;
@@ -299,25 +304,30 @@ interface Scanner {
299
304
  acceptWhitespaceChar(): string | null;
300
305
  }
301
306
 
302
- declare function parse(scanner: Scanner, cxt: ParseContext): Document;
307
+ declare function parse(scanner: Scanner, cxt: ParseContext): Document$1;
303
308
 
304
- type RendererType<TState, TReturn, TOptions = undefined> = {
309
+ type RendererType<TState, TReturn, TDocument, TOptions = undefined> = {
305
310
  state: TState;
306
311
  return: TReturn;
312
+ document: TDocument;
307
313
  options: TOptions;
308
314
  };
309
- type AnyRendererType = RendererType<any, any, any>;
310
- type getState<Type> = Type extends RendererType<infer T, any, any> ? T : never;
311
- type getReturn<Type> = Type extends RendererType<any, infer T, any> ? T : never;
312
- 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;
313
320
  type NodeRenderer<Type extends AnyRendererType, TNode> = (node: TNode, cxt: RenderContext<Type>) => getReturn<Type>;
314
- 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
+ ];
315
325
  declare class RenderContext<Type extends AnyRendererType> {
316
326
  readonly config: RenderConfiguration<Type>;
317
- readonly parseContext: ParseContext;
327
+ readonly parsedDocument: Document$1;
318
328
  state: getState<Type>;
319
329
  renderEntity(node: BlockEntity | InlineEntity): getReturn<Type> | undefined;
320
- constructor(config: RenderConfiguration<Type>, parseContext: ParseContext, state: getState<Type>);
330
+ constructor(config: RenderConfiguration<Type>, parsedDocument: Document$1, state: getState<Type>);
321
331
  }
322
332
  interface ReadonlyRenderConfiguration<Type extends AnyRendererType> {
323
333
  readonly options: getOptions<Type>;
@@ -327,22 +337,22 @@ interface ReadonlyRenderConfiguration<Type extends AnyRendererType> {
327
337
  readonly undefinedInlineRenderer?: NodeRenderer<Type, InlineModifierNode<any>>;
328
338
  readonly blockRenderers: ReadonlyMap<BlockModifierDefinition<any>, NodeRenderer<Type, BlockModifierNode<any>>>;
329
339
  readonly inlineRenderers: ReadonlyMap<InlineModifierDefinition<any>, NodeRenderer<Type, InlineModifierNode<any>>>;
330
- readonly postprocessor: (results: getReturn<Type>[], cxt: RenderContext<Type>) => getReturn<Type>;
331
- 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>;
332
342
  }
333
343
  type BlockRendererDefiniton<Type extends AnyRendererType, ModState = any> = NodeRendererDefinition<Type, BlockModifierNode<ModState>, BlockModifierDefinition<ModState>>;
334
344
  type InlineRendererDefiniton<Type extends AnyRendererType, ModState = any> = NodeRendererDefinition<Type, InlineModifierNode<ModState>, InlineModifierDefinition<ModState>>;
335
345
  declare class RenderConfiguration<Type extends AnyRendererType> implements ReadonlyRenderConfiguration<Type> {
336
346
  options: getOptions<Type>;
337
- postprocessor: (results: getReturn<Type>[], cxt: RenderContext<Type>) => getReturn<Type>;
347
+ postprocessor: (results: getReturn<Type>[], cxt: RenderContext<Type>) => getDocument<Type>;
338
348
  paragraphRenderer?: NodeRenderer<Type, ParagraphNode>;
339
349
  textRenderer?: NodeRenderer<Type, TextNode | PreNode | EscapedNode>;
340
350
  undefinedBlockRenderer?: NodeRenderer<Type, BlockModifierNode<any>>;
341
351
  undefinedInlineRenderer?: NodeRenderer<Type, InlineModifierNode<any>>;
342
352
  blockRenderers: Map<BlockModifierDefinition<any>, NodeRenderer<Type, BlockModifierNode<any>>>;
343
353
  inlineRenderers: Map<InlineModifierDefinition<any>, NodeRenderer<Type, InlineModifierNode<any>>>;
344
- constructor(options: getOptions<Type>, postprocessor: (results: getReturn<Type>[], cxt: RenderContext<Type>) => getReturn<Type>);
345
- 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>;
346
356
  addBlockRenderer(...rs: BlockRendererDefiniton<Type>[]): void;
347
357
  addInlineRenderer(...rs: InlineRendererDefiniton<Type>[]): void;
348
358
  static from<Type extends AnyRendererType>(from: ReadonlyRenderConfiguration<Type>): RenderConfiguration<Type>;
@@ -558,6 +568,21 @@ declare namespace messages {
558
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 };
559
569
  }
560
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 };
584
+ }
585
+
561
586
  declare const BuiltinConfiguration: ReadonlyConfiguration;
562
587
 
563
588
  declare const DefaultConfiguration: ReadonlyConfiguration;
@@ -566,24 +591,25 @@ type HTMLRendererOptions = {
566
591
  headPlugins: HTMLComponentPlugin[];
567
592
  headerPlugins: HTMLComponentPlugin[];
568
593
  footerPlugins: HTMLComponentPlugin[];
594
+ postprocessPlugins: HTMLPostprocessPlugin[];
569
595
  transformAsset: (id: string) => string | undefined;
570
596
  };
571
597
  type HTMLRenderType = {
572
598
  state: HTMLRenderState;
573
599
  options: HTMLRendererOptions;
574
- return: string;
600
+ document: Document;
601
+ return: Node | Node[];
575
602
  };
576
603
  type HTMLRenderPlugin = (elem: BlockEntity | InlineEntity, cxt: RenderContext<HTMLRenderType>) => string | undefined;
577
- type HTMLComponentPlugin = (cxt: RenderContext<HTMLRenderType>) => string | undefined;
578
- 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;
579
606
  declare class HTMLRenderState {
580
607
  title: string;
581
608
  stylesheet: string;
582
609
  cssVariables: Map<string, string>;
583
- escape(content: string): string;
584
- invalidBlock(node: BlockEntity, msg: string): string;
585
- invalidInline(node: InlineEntity, msg: string): string;
586
- 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;
587
613
  }
588
614
  declare const HTMLRenderConfiguration: ReadonlyRenderConfiguration<HTMLRenderType>;
589
615
 
@@ -600,9 +626,9 @@ declare const debugPrint: {
600
626
  };
601
627
  declare function debugPrintRange(loc: LocationRange, context?: number): string;
602
628
  declare function debugPrintMsg(m: Message): string;
603
- declare function debugDumpDocument(doc: Document): string;
629
+ declare function debugDumpDocument(doc: Document$1): string;
604
630
 
605
631
  declare const emmmVersion = "0.0.6";
606
632
  declare function setDebugLevel(level: DebugLevel): void;
607
633
 
608
- 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 Source, type SourceDescriptor, StringSource, SystemModifierDefinition, type SystemModifierNode, type TextNode, debugPrint, emmmVersion, 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 };