@wdprlib/ast 0.1.5 → 1.0.0-rc.0

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/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # @wdprlib/ast
2
+
3
+ AST type definitions for Wikidot markup.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ bun add @wdprlib/ast
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```ts
14
+ import type { SyntaxTree, Element } from "@wdprlib/ast";
15
+ import { text, paragraph, bold } from "@wdprlib/ast";
16
+
17
+ // Create AST nodes
18
+ const tree: SyntaxTree = {
19
+ elements: [paragraph([bold([text("Hello")]), text(" world")])],
20
+ };
21
+ ```
22
+
23
+ ## Exports
24
+
25
+ Types: `SyntaxTree`, `Element`, `ElementName`, `ContainerType`, `AttributeMap`, `LinkType`, `ListType`, `Module`, etc.
26
+
27
+ Helpers: `text`, `paragraph`, `bold`, `italics`, `heading`, `link`, `list`, `lineBreak`, `horizontalRule`
28
+
29
+ ## Related Packages
30
+
31
+ - [@wdprlib/parser](https://www.npmjs.com/package/@wdprlib/parser) - Wikidot markup parser
32
+ - [@wdprlib/render](https://www.npmjs.com/package/@wdprlib/render) - HTML renderer
33
+ - [@wdprlib/runtime](https://www.npmjs.com/package/@wdprlib/runtime) - Client-side runtime
34
+
35
+ ## License
36
+
37
+ AGPL-3.0 - See [LICENSE](https://github.com/r74tech/wdpr/blob/develop/LICENSE)
package/dist/index.cjs CHANGED
@@ -215,6 +215,8 @@ function isParagraphSafe(element) {
215
215
  return true;
216
216
  case "embed":
217
217
  return false;
218
+ case "embed-block":
219
+ return true;
218
220
  case "html":
219
221
  case "iframe":
220
222
  return false;
package/dist/index.d.cts CHANGED
@@ -367,7 +367,7 @@ interface BibliographyCiteData {
367
367
  brackets: boolean;
368
368
  }
369
369
  interface BibliographyBlockData {
370
- index: number;
370
+ entries: DefinitionListItem[];
371
371
  title: string | null;
372
372
  hide: boolean;
373
373
  }
@@ -393,6 +393,15 @@ interface MathInlineData {
393
393
  }
394
394
  interface HtmlData {
395
395
  contents: string;
396
+ style?: string;
397
+ }
398
+ /**
399
+ * Embed block data (Wikidot style [[embed]]..[[/embed]])
400
+ * Contains raw HTML that is validated against an allowlist at render time.
401
+ * Unlike html element, embed-block is paragraph-safe.
402
+ */
403
+ interface EmbedBlockData {
404
+ contents: string;
396
405
  }
397
406
  interface IframeData {
398
407
  url: string;
@@ -464,6 +473,7 @@ type ElementDataMap = {
464
473
  "math-inline": MathInlineData;
465
474
  "equation-reference": string;
466
475
  embed: Embed;
476
+ "embed-block": EmbedBlockData;
467
477
  html: HtmlData;
468
478
  iframe: IframeData;
469
479
  include: IncludeData;
@@ -580,4 +590,4 @@ declare function isContainerTypeParagraphSafe(type: ContainerType): boolean;
580
590
  */
581
591
  declare function isParagraphSafe(element: Element): boolean;
582
592
  type Version = "wikidot";
583
- export { text, paragraph, listItemSubList, listItemElements, list, link, lineBreak, italics, isStringContainerType, isParagraphSafe, isHeaderType, isContainerTypeParagraphSafe, isAlignType, horizontalRule, heading, createPosition, createPoint, container, bold, Version, VariableMap, UserData, TocEntry, TableRow, TableOfContentsData, TableData, TableCell, TabData, SyntaxTree, StringContainerType, Position, Point, PageRef, Module, MathInlineData, MathData, ListType, ListItem, ListData, LinkType, LinkLocation, LinkLabel, LinkData, IncludeData, ImageSource, ImageData, IframeData, IfTagsData, IfExprData, IfCondData, HtmlData, HeadingLevel, Heading, HeaderType, FootnoteBlockData, FloatAlignment, ExprData, Embed, ElementOf, ElementName, ElementDataMap, ElementData, Element, DefinitionListItem, DateItem, DateData, ContainerType, ContainerData, ColorData, CollapsibleData, CodeBlockData, ClearFloat, BibliographyCiteData, BibliographyBlockData, AttributeMap, AnchorTarget, AnchorData, Alignment, AlignType };
593
+ export { text, paragraph, listItemSubList, listItemElements, list, link, lineBreak, italics, isStringContainerType, isParagraphSafe, isHeaderType, isContainerTypeParagraphSafe, isAlignType, horizontalRule, heading, createPosition, createPoint, container, bold, Version, VariableMap, UserData, TocEntry, TableRow, TableOfContentsData, TableData, TableCell, TabData, SyntaxTree, StringContainerType, Position, Point, PageRef, Module, MathInlineData, MathData, ListType, ListItem, ListData, LinkType, LinkLocation, LinkLabel, LinkData, IncludeData, ImageSource, ImageData, IframeData, IfTagsData, IfExprData, IfCondData, HtmlData, HeadingLevel, Heading, HeaderType, FootnoteBlockData, FloatAlignment, ExprData, EmbedBlockData, Embed, ElementOf, ElementName, ElementDataMap, ElementData, Element, DefinitionListItem, DateItem, DateData, ContainerType, ContainerData, ColorData, CollapsibleData, CodeBlockData, ClearFloat, BibliographyCiteData, BibliographyBlockData, AttributeMap, AnchorTarget, AnchorData, Alignment, AlignType };
package/dist/index.d.ts CHANGED
@@ -367,7 +367,7 @@ interface BibliographyCiteData {
367
367
  brackets: boolean;
368
368
  }
369
369
  interface BibliographyBlockData {
370
- index: number;
370
+ entries: DefinitionListItem[];
371
371
  title: string | null;
372
372
  hide: boolean;
373
373
  }
@@ -393,6 +393,15 @@ interface MathInlineData {
393
393
  }
394
394
  interface HtmlData {
395
395
  contents: string;
396
+ style?: string;
397
+ }
398
+ /**
399
+ * Embed block data (Wikidot style [[embed]]..[[/embed]])
400
+ * Contains raw HTML that is validated against an allowlist at render time.
401
+ * Unlike html element, embed-block is paragraph-safe.
402
+ */
403
+ interface EmbedBlockData {
404
+ contents: string;
396
405
  }
397
406
  interface IframeData {
398
407
  url: string;
@@ -464,6 +473,7 @@ type ElementDataMap = {
464
473
  "math-inline": MathInlineData;
465
474
  "equation-reference": string;
466
475
  embed: Embed;
476
+ "embed-block": EmbedBlockData;
467
477
  html: HtmlData;
468
478
  iframe: IframeData;
469
479
  include: IncludeData;
@@ -580,4 +590,4 @@ declare function isContainerTypeParagraphSafe(type: ContainerType): boolean;
580
590
  */
581
591
  declare function isParagraphSafe(element: Element): boolean;
582
592
  type Version = "wikidot";
583
- export { text, paragraph, listItemSubList, listItemElements, list, link, lineBreak, italics, isStringContainerType, isParagraphSafe, isHeaderType, isContainerTypeParagraphSafe, isAlignType, horizontalRule, heading, createPosition, createPoint, container, bold, Version, VariableMap, UserData, TocEntry, TableRow, TableOfContentsData, TableData, TableCell, TabData, SyntaxTree, StringContainerType, Position, Point, PageRef, Module, MathInlineData, MathData, ListType, ListItem, ListData, LinkType, LinkLocation, LinkLabel, LinkData, IncludeData, ImageSource, ImageData, IframeData, IfTagsData, IfExprData, IfCondData, HtmlData, HeadingLevel, Heading, HeaderType, FootnoteBlockData, FloatAlignment, ExprData, Embed, ElementOf, ElementName, ElementDataMap, ElementData, Element, DefinitionListItem, DateItem, DateData, ContainerType, ContainerData, ColorData, CollapsibleData, CodeBlockData, ClearFloat, BibliographyCiteData, BibliographyBlockData, AttributeMap, AnchorTarget, AnchorData, Alignment, AlignType };
593
+ export { text, paragraph, listItemSubList, listItemElements, list, link, lineBreak, italics, isStringContainerType, isParagraphSafe, isHeaderType, isContainerTypeParagraphSafe, isAlignType, horizontalRule, heading, createPosition, createPoint, container, bold, Version, VariableMap, UserData, TocEntry, TableRow, TableOfContentsData, TableData, TableCell, TabData, SyntaxTree, StringContainerType, Position, Point, PageRef, Module, MathInlineData, MathData, ListType, ListItem, ListData, LinkType, LinkLocation, LinkLabel, LinkData, IncludeData, ImageSource, ImageData, IframeData, IfTagsData, IfExprData, IfCondData, HtmlData, HeadingLevel, Heading, HeaderType, FootnoteBlockData, FloatAlignment, ExprData, EmbedBlockData, Embed, ElementOf, ElementName, ElementDataMap, ElementData, Element, DefinitionListItem, DateItem, DateData, ContainerType, ContainerData, ColorData, CollapsibleData, CodeBlockData, ClearFloat, BibliographyCiteData, BibliographyBlockData, AttributeMap, AnchorTarget, AnchorData, Alignment, AlignType };
package/dist/index.js CHANGED
@@ -161,6 +161,8 @@ function isParagraphSafe(element) {
161
161
  return true;
162
162
  case "embed":
163
163
  return false;
164
+ case "embed-block":
165
+ return true;
164
166
  case "html":
165
167
  case "iframe":
166
168
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdprlib/ast",
3
- "version": "0.1.5",
3
+ "version": "1.0.0-rc.0",
4
4
  "description": "AST types for Wikidot markup",
5
5
  "keywords": [
6
6
  "ast",