@marvalt/wparser 0.1.0 → 0.1.3
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 +126 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +35 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +124 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/registry/defaultRegistry.d.ts.map +1 -1
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/shortcodeParser.d.ts +29 -0
- package/dist/utils/shortcodeParser.d.ts.map +1 -0
- package/package.json +2 -3
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ShortcodeAttributes, ComponentRegistry } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Parse shortcode attributes from a string
|
|
5
|
+
* Supports: [shortcode attr="value" attr2="value2"]
|
|
6
|
+
*/
|
|
7
|
+
export declare function parseShortcodeAttrs(attrString?: string): ShortcodeAttributes;
|
|
8
|
+
/**
|
|
9
|
+
* Parse shortcode from text
|
|
10
|
+
* Returns: { name, attrs, content, fullMatch }
|
|
11
|
+
*/
|
|
12
|
+
export interface ParsedShortcode {
|
|
13
|
+
name: string;
|
|
14
|
+
attrs: ShortcodeAttributes;
|
|
15
|
+
content?: string;
|
|
16
|
+
fullMatch: string;
|
|
17
|
+
startIndex: number;
|
|
18
|
+
endIndex: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Find all shortcodes in text
|
|
22
|
+
* Supports: [shortcode], [shortcode attr="value"], [shortcode]content[/shortcode]
|
|
23
|
+
*/
|
|
24
|
+
export declare function findShortcodes(text: string): ParsedShortcode[];
|
|
25
|
+
/**
|
|
26
|
+
* Render text with shortcodes replaced by React components
|
|
27
|
+
*/
|
|
28
|
+
export declare function renderTextWithShortcodes(text: string, registry: ComponentRegistry): React.ReactNode[];
|
|
29
|
+
//# sourceMappingURL=shortcodeParser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shortcodeParser.d.ts","sourceRoot":"","sources":["../../src/utils/shortcodeParser.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,mBAAmB,EAAqB,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE1F;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,mBAAmB,CAe5E;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,mBAAmB,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,EAAE,CA6D9D;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,iBAAiB,GAC1B,KAAK,CAAC,SAAS,EAAE,CA4CnB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marvalt/wparser",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Static-only WordPress page parser and renderer (Gutenberg blocks → React) for Digivalt apps",
|
|
5
5
|
"license": "GPL-3.0-or-later",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"README.md",
|
|
19
19
|
"LICENSE"
|
|
20
20
|
],
|
|
21
|
+
"type": "module",
|
|
21
22
|
"sideEffects": false,
|
|
22
23
|
"scripts": {
|
|
23
24
|
"build": "rollup -c",
|
|
@@ -66,5 +67,3 @@
|
|
|
66
67
|
"npm": ">=8.0.0"
|
|
67
68
|
}
|
|
68
69
|
}
|
|
69
|
-
|
|
70
|
-
|