@wdprlib/ast 1.2.1 → 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/dist/index.cjs +6 -3
- package/dist/index.d.cts +25 -6
- package/dist/index.d.ts +25 -6
- package/dist/index.js +6 -3
- package/package.json +1 -1
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
|
}
|