@wdprlib/ast 1.2.0 → 2.0.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # @wdprlib/ast
2
2
 
3
- AST type definitions for Wikidot markup.
3
+ AST types for Wikidot markup.
4
4
 
5
5
  ## Installation
6
6
 
@@ -30,6 +30,7 @@ Helpers: `text`, `paragraph`, `bold`, `italics`, `heading`, `link`, `list`, `lin
30
30
 
31
31
  - [@wdprlib/parser](https://www.npmjs.com/package/@wdprlib/parser) - Wikidot markup parser
32
32
  - [@wdprlib/render](https://www.npmjs.com/package/@wdprlib/render) - HTML renderer
33
+ - [@wdprlib/decompiler](https://www.npmjs.com/package/@wdprlib/decompiler) - HTML to Wikidot decompiler
33
34
  - [@wdprlib/runtime](https://www.npmjs.com/package/@wdprlib/runtime) - Client-side runtime
34
35
 
35
36
  ## License
package/dist/index.cjs CHANGED
@@ -259,7 +259,8 @@ function createSettings(mode) {
259
259
  enablePageSyntax: true,
260
260
  allowLocalPaths: true,
261
261
  useTrueIds: true,
262
- allowStyleElements: true
262
+ allowStyleElements: true,
263
+ allowHtmlBlocks: true
263
264
  };
264
265
  case "draft":
265
266
  return {
@@ -267,7 +268,8 @@ function createSettings(mode) {
267
268
  enablePageSyntax: true,
268
269
  allowLocalPaths: true,
269
270
  useTrueIds: false,
270
- allowStyleElements: false
271
+ allowStyleElements: false,
272
+ allowHtmlBlocks: false
271
273
  };
272
274
  case "forum-post":
273
275
  case "direct-message":
@@ -276,7 +278,8 @@ function createSettings(mode) {
276
278
  enablePageSyntax: false,
277
279
  allowLocalPaths: false,
278
280
  useTrueIds: false,
279
- allowStyleElements: false
281
+ allowStyleElements: false,
282
+ allowHtmlBlocks: false
280
283
  };
281
284
  }
282
285
  }
package/dist/index.d.cts CHANGED
@@ -1154,12 +1154,12 @@ declare const STYLE_SLOT_PREFIX = "\0__IFTAGS_SLOT__";
1154
1154
  * {@link WikitextSettings}. The modes correspond to the places where
1155
1155
  * user-authored wikitext can appear on a Wikidot site.
1156
1156
  *
1157
- * | Mode | Page syntax | Local paths | True IDs | Style elements |
1158
- * |--------------------|:-----------:|:-----------:|:--------:|:--------------:|
1159
- * | `"page"` | yes | yes | yes | yes |
1160
- * | `"draft"` | yes | yes | no | no |
1161
- * | `"forum-post"` | no | no | no | no |
1162
- * | `"direct-message"` | no | no | no | no |
1157
+ * | Mode | Page syntax | Local paths | True IDs | Style elements | HTML blocks |
1158
+ * |--------------------|:-----------:|:-----------:|:--------:|:--------------:|:-----------:|
1159
+ * | `"page"` | yes | yes | yes | yes | yes |
1160
+ * | `"draft"` | yes | yes | no | no | no |
1161
+ * | `"forum-post"` | no | no | no | no | no |
1162
+ * | `"direct-message"` | no | no | no | no | no |
1163
1163
  *
1164
1164
  * @group Settings
1165
1165
  */
@@ -1210,6 +1210,25 @@ interface WikitextSettings {
1210
1210
  * the CSS module is silently ignored.
1211
1211
  */
1212
1212
  allowStyleElements: boolean;
1213
+ /**
1214
+ * Whether `[[html]]` blocks are recognised by the parser and rendered.
1215
+ *
1216
+ * HTML blocks embed raw HTML that the renderer serves inside a sandboxed
1217
+ * iframe. The capability is meaningful only in contexts that can host
1218
+ * the auxiliary iframe URL, so it is disabled in drafts, forum posts,
1219
+ * and direct messages.
1220
+ *
1221
+ * When `false`, the parser still consumes the entire `[[html]]...[[/html]]`
1222
+ * span (so the raw body cannot leak as text) but emits no AST node, and
1223
+ * the renderer skips any pre-existing `html` element it encounters.
1224
+ *
1225
+ * Wikidot's legacy `Text_Wiki` keeps `Html` in its `$disable` list by
1226
+ * default (`lib/Text_Wiki/Text/Wiki.php` line 145-147), so an authentic
1227
+ * Wikidot-compat default would be `false` even in `"page"` mode. wp
1228
+ * keeps `"page"` at `true` for now to preserve existing consumers; a
1229
+ * future change may align with Wikidot.
1230
+ */
1231
+ allowHtmlBlocks: boolean;
1213
1232
  }
1214
1233
  /**
1215
1234
  * Create a {@link WikitextSettings} with sensible defaults for the given mode.
package/dist/index.d.ts CHANGED
@@ -1154,12 +1154,12 @@ declare const STYLE_SLOT_PREFIX = "\0__IFTAGS_SLOT__";
1154
1154
  * {@link WikitextSettings}. The modes correspond to the places where
1155
1155
  * user-authored wikitext can appear on a Wikidot site.
1156
1156
  *
1157
- * | Mode | Page syntax | Local paths | True IDs | Style elements |
1158
- * |--------------------|:-----------:|:-----------:|:--------:|:--------------:|
1159
- * | `"page"` | yes | yes | yes | yes |
1160
- * | `"draft"` | yes | yes | no | no |
1161
- * | `"forum-post"` | no | no | no | no |
1162
- * | `"direct-message"` | no | no | no | no |
1157
+ * | Mode | Page syntax | Local paths | True IDs | Style elements | HTML blocks |
1158
+ * |--------------------|:-----------:|:-----------:|:--------:|:--------------:|:-----------:|
1159
+ * | `"page"` | yes | yes | yes | yes | yes |
1160
+ * | `"draft"` | yes | yes | no | no | no |
1161
+ * | `"forum-post"` | no | no | no | no | no |
1162
+ * | `"direct-message"` | no | no | no | no | no |
1163
1163
  *
1164
1164
  * @group Settings
1165
1165
  */
@@ -1210,6 +1210,25 @@ interface WikitextSettings {
1210
1210
  * the CSS module is silently ignored.
1211
1211
  */
1212
1212
  allowStyleElements: boolean;
1213
+ /**
1214
+ * Whether `[[html]]` blocks are recognised by the parser and rendered.
1215
+ *
1216
+ * HTML blocks embed raw HTML that the renderer serves inside a sandboxed
1217
+ * iframe. The capability is meaningful only in contexts that can host
1218
+ * the auxiliary iframe URL, so it is disabled in drafts, forum posts,
1219
+ * and direct messages.
1220
+ *
1221
+ * When `false`, the parser still consumes the entire `[[html]]...[[/html]]`
1222
+ * span (so the raw body cannot leak as text) but emits no AST node, and
1223
+ * the renderer skips any pre-existing `html` element it encounters.
1224
+ *
1225
+ * Wikidot's legacy `Text_Wiki` keeps `Html` in its `$disable` list by
1226
+ * default (`lib/Text_Wiki/Text/Wiki.php` line 145-147), so an authentic
1227
+ * Wikidot-compat default would be `false` even in `"page"` mode. wp
1228
+ * keeps `"page"` at `true` for now to preserve existing consumers; a
1229
+ * future change may align with Wikidot.
1230
+ */
1231
+ allowHtmlBlocks: boolean;
1213
1232
  }
1214
1233
  /**
1215
1234
  * Create a {@link WikitextSettings} with sensible defaults for the given mode.
package/dist/index.js CHANGED
@@ -202,7 +202,8 @@ function createSettings(mode) {
202
202
  enablePageSyntax: true,
203
203
  allowLocalPaths: true,
204
204
  useTrueIds: true,
205
- allowStyleElements: true
205
+ allowStyleElements: true,
206
+ allowHtmlBlocks: true
206
207
  };
207
208
  case "draft":
208
209
  return {
@@ -210,7 +211,8 @@ function createSettings(mode) {
210
211
  enablePageSyntax: true,
211
212
  allowLocalPaths: true,
212
213
  useTrueIds: false,
213
- allowStyleElements: false
214
+ allowStyleElements: false,
215
+ allowHtmlBlocks: false
214
216
  };
215
217
  case "forum-post":
216
218
  case "direct-message":
@@ -219,7 +221,8 @@ function createSettings(mode) {
219
221
  enablePageSyntax: false,
220
222
  allowLocalPaths: false,
221
223
  useTrueIds: false,
222
- allowStyleElements: false
224
+ allowStyleElements: false,
225
+ allowHtmlBlocks: false
223
226
  };
224
227
  }
225
228
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdprlib/ast",
3
- "version": "1.2.0",
3
+ "version": "2.0.0",
4
4
  "description": "AST types for Wikidot markup",
5
5
  "keywords": [
6
6
  "ast",