@grafctory/mime-xml 0.0.0-stage → 0.6.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/LICENSE +201 -0
- package/README.md +65 -2
- package/dist/denoise.core.d.ts +12 -0
- package/dist/denoise.core.d.ts.map +1 -0
- package/dist/denoise.core.js +78 -0
- package/dist/denoise.core.js.map +1 -0
- package/dist/denoise.d.ts +45 -0
- package/dist/denoise.d.ts.map +1 -0
- package/dist/denoise.js +63 -0
- package/dist/denoise.js.map +1 -0
- package/dist/focus.core.d.ts +9 -0
- package/dist/focus.core.d.ts.map +1 -0
- package/dist/focus.core.js +305 -0
- package/dist/focus.core.js.map +1 -0
- package/dist/focus.d.ts +64 -0
- package/dist/focus.d.ts.map +1 -0
- package/dist/focus.js +88 -0
- package/dist/focus.js.map +1 -0
- package/dist/html.core.d.ts +9 -0
- package/dist/html.core.d.ts.map +1 -0
- package/dist/html.core.js +229 -0
- package/dist/html.core.js.map +1 -0
- package/dist/html.d.ts +76 -0
- package/dist/html.d.ts.map +1 -0
- package/dist/html.js +104 -0
- package/dist/html.js.map +1 -0
- package/dist/index.core.d.ts +74 -0
- package/dist/index.core.d.ts.map +1 -0
- package/dist/index.core.js +117 -0
- package/dist/index.core.js.map +1 -0
- package/dist/index.d.ts +67 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +116 -0
- package/dist/index.js.map +1 -0
- package/dist/untag.core.d.ts +9 -0
- package/dist/untag.core.d.ts.map +1 -0
- package/dist/untag.core.js +219 -0
- package/dist/untag.core.js.map +1 -0
- package/dist/untag.d.ts +90 -0
- package/dist/untag.d.ts.map +1 -0
- package/dist/untag.js +106 -0
- package/dist/untag.js.map +1 -0
- package/dist/unwrap.d.ts +37 -0
- package/dist/unwrap.d.ts.map +1 -0
- package/dist/unwrap.js +69 -0
- package/dist/unwrap.js.map +1 -0
- package/dist/xml.core.d.ts +9 -0
- package/dist/xml.core.d.ts.map +1 -0
- package/dist/xml.core.js +86 -0
- package/dist/xml.core.js.map +1 -0
- package/dist/xml.d.ts +69 -0
- package/dist/xml.d.ts.map +1 -0
- package/dist/xml.js +97 -0
- package/dist/xml.js.map +1 -0
- package/dist/xpath.core.d.ts +100 -0
- package/dist/xpath.core.d.ts.map +1 -0
- package/dist/xpath.core.js +279 -0
- package/dist/xpath.core.js.map +1 -0
- package/dist/xpath.d.ts +128 -0
- package/dist/xpath.d.ts.map +1 -0
- package/dist/xpath.js +33 -0
- package/dist/xpath.js.map +1 -0
- package/package.json +62 -4
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type IRI } from "@grafctory/core/resource";
|
|
2
|
+
import { type Target } from "./xpath.core.js";
|
|
3
|
+
export * from "./xml.js";
|
|
4
|
+
export * from "./html.js";
|
|
5
|
+
export * from "./denoise.js";
|
|
6
|
+
export * from "./xpath.js";
|
|
7
|
+
export * from "./focus.js";
|
|
8
|
+
export * from "./untag.js";
|
|
9
|
+
export * from "./unwrap.js";
|
|
10
|
+
/**
|
|
11
|
+
* Reads a selected value as a boolean.
|
|
12
|
+
*
|
|
13
|
+
* Accepts only the `true` and `false` forms produced by XPath itself, so that computed booleans are read back unchanged
|
|
14
|
+
* and any other text is rejected rather than guessed at.
|
|
15
|
+
*
|
|
16
|
+
* @param node The {@link Target} to read, either a selected node or a computed value
|
|
17
|
+
*
|
|
18
|
+
* @returns `true` if the text of `node` is `true`; `false` if it is `false`
|
|
19
|
+
*
|
|
20
|
+
* @throws {@link !TypeError TypeError} If the text of `node` is neither `true` nor `false`
|
|
21
|
+
*/
|
|
22
|
+
export declare function boolean(node: Target): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Reads a selected value as a number.
|
|
25
|
+
*
|
|
26
|
+
* Empty text is rejected rather than read as zero, so that a missing figure isn't passed downstream as a plausible one.
|
|
27
|
+
*
|
|
28
|
+
* @param node The {@link Target} to read, either a selected node or a computed value
|
|
29
|
+
*
|
|
30
|
+
* @returns The number written in the text of `node`
|
|
31
|
+
*
|
|
32
|
+
* @throws {@link !TypeError TypeError} If the text of `node` is not a finite number
|
|
33
|
+
*/
|
|
34
|
+
export declare function number(node: Target): number;
|
|
35
|
+
/**
|
|
36
|
+
* Reads a selected value as text.
|
|
37
|
+
*
|
|
38
|
+
* Converts values as the XPath `string()` function does: attributes are read as their value, other nodes as the text
|
|
39
|
+
* content of their subtree (comments excluded), and computed strings, numbers or booleans as their written form.
|
|
40
|
+
*
|
|
41
|
+
* @param node The {@link Target} to read, either a selected node or a computed value
|
|
42
|
+
*
|
|
43
|
+
* @returns The text of `node`, with whitespace runs collapsed to a single space and leading and trailing whitespace
|
|
44
|
+
* removed, so that content spread across several lines reads as evenly spaced text
|
|
45
|
+
*
|
|
46
|
+
* @see {@link https://www.w3.org/TR/1999/REC-xpath-19991116/#function-string XML Path Language (XPath) 1.0 - string()}
|
|
47
|
+
*/
|
|
48
|
+
export declare function string(node: Target): string;
|
|
49
|
+
/**
|
|
50
|
+
* Reads a selected value as a link.
|
|
51
|
+
*
|
|
52
|
+
* Resolves the reference against the base URL in scope at `node`, as recorded by the {@link xml} and {@link html}
|
|
53
|
+
* parsers, so that consumers always work on absolute IRIs, wherever the reference appears in the document. References
|
|
54
|
+
* are returned unresolved for computed values and for trees without a base URL, such as trees parsed from text
|
|
55
|
+
* without a `base` argument.
|
|
56
|
+
*
|
|
57
|
+
* @param node The {@link Target} to read, either a selected node or a computed value
|
|
58
|
+
*
|
|
59
|
+
* @returns The IRI written in the text of `node`, resolved against the base URL in scope at `node`, if any
|
|
60
|
+
*
|
|
61
|
+
* @throws {@link !TypeError TypeError} If the text of `node` is neither an IRI nor a relative reference
|
|
62
|
+
*
|
|
63
|
+
* @see {@link https://www.rfc-editor.org/rfc/rfc3987 RFC 3987 Internationalized Resource Identifiers}
|
|
64
|
+
* @see {@link https://www.w3.org/TR/xmlbase/ XML Base}
|
|
65
|
+
*/
|
|
66
|
+
export declare function link(node: Target): IRI;
|
|
67
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA8BA,OAAO,EAAE,KAAK,GAAG,EAAS,MAAM,0BAA0B,CAAC;AAE3D,OAAO,EAAiB,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE7D,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAG5B;;;;;;;;;;;GAWG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAM7C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM3C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE3C;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAsBtC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © 2026 Metreeca srl
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* XML and HTML processing tasks.
|
|
18
|
+
*
|
|
19
|
+
* Provides ready-made {@link https://github.com/grafctory/flow @grafctory/flow} tasks and helpers for processing XML and
|
|
20
|
+
* HTML content in pipelines run by the {@link https://github.com/grafctory/gear @grafctory/gear} executor.
|
|
21
|
+
*
|
|
22
|
+
* @module index
|
|
23
|
+
*
|
|
24
|
+
* @see {@link https://www.w3.org/TR/xml/ Extensible Markup Language (XML) 1.0}
|
|
25
|
+
* @see {@link https://html.spec.whatwg.org/multipage/ WHATWG HTML Living Standard}
|
|
26
|
+
* @see {@link https://www.w3.org/TR/1999/REC-xpath-19991116/ XML Path Language (XPath) 1.0}
|
|
27
|
+
*/
|
|
28
|
+
import { assert, isBoolean, isNumber } from "@grafctory/core";
|
|
29
|
+
import { isIRI } from "@grafctory/core/resource";
|
|
30
|
+
import { tidy } from "@grafctory/core/strings";
|
|
31
|
+
import { base, content } from "./xpath.core.js";
|
|
32
|
+
export * from "./xml.js";
|
|
33
|
+
export * from "./html.js";
|
|
34
|
+
export * from "./denoise.js";
|
|
35
|
+
export * from "./xpath.js";
|
|
36
|
+
export * from "./focus.js";
|
|
37
|
+
export * from "./untag.js";
|
|
38
|
+
export * from "./unwrap.js";
|
|
39
|
+
/**
|
|
40
|
+
* Reads a selected value as a boolean.
|
|
41
|
+
*
|
|
42
|
+
* Accepts only the `true` and `false` forms produced by XPath itself, so that computed booleans are read back unchanged
|
|
43
|
+
* and any other text is rejected rather than guessed at.
|
|
44
|
+
*
|
|
45
|
+
* @param node The {@link Target} to read, either a selected node or a computed value
|
|
46
|
+
*
|
|
47
|
+
* @returns `true` if the text of `node` is `true`; `false` if it is `false`
|
|
48
|
+
*
|
|
49
|
+
* @throws {@link !TypeError TypeError} If the text of `node` is neither `true` nor `false`
|
|
50
|
+
*/
|
|
51
|
+
export function boolean(node) {
|
|
52
|
+
const text = string(node);
|
|
53
|
+
return assert(text === "true" ? true : text === "false" ? false : undefined, isBoolean);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Reads a selected value as a number.
|
|
57
|
+
*
|
|
58
|
+
* Empty text is rejected rather than read as zero, so that a missing figure isn't passed downstream as a plausible one.
|
|
59
|
+
*
|
|
60
|
+
* @param node The {@link Target} to read, either a selected node or a computed value
|
|
61
|
+
*
|
|
62
|
+
* @returns The number written in the text of `node`
|
|
63
|
+
*
|
|
64
|
+
* @throws {@link !TypeError TypeError} If the text of `node` is not a finite number
|
|
65
|
+
*/
|
|
66
|
+
export function number(node) {
|
|
67
|
+
const text = string(node);
|
|
68
|
+
return assert(text ? Number(text) : NaN, isNumber); // empty text reads as 0, which a node holding none doesn't name
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Reads a selected value as text.
|
|
72
|
+
*
|
|
73
|
+
* Converts values as the XPath `string()` function does: attributes are read as their value, other nodes as the text
|
|
74
|
+
* content of their subtree (comments excluded), and computed strings, numbers or booleans as their written form.
|
|
75
|
+
*
|
|
76
|
+
* @param node The {@link Target} to read, either a selected node or a computed value
|
|
77
|
+
*
|
|
78
|
+
* @returns The text of `node`, with whitespace runs collapsed to a single space and leading and trailing whitespace
|
|
79
|
+
* removed, so that content spread across several lines reads as evenly spaced text
|
|
80
|
+
*
|
|
81
|
+
* @see {@link https://www.w3.org/TR/1999/REC-xpath-19991116/#function-string XML Path Language (XPath) 1.0 - string()}
|
|
82
|
+
*/
|
|
83
|
+
export function string(node) {
|
|
84
|
+
return tidy(content(node));
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Reads a selected value as a link.
|
|
88
|
+
*
|
|
89
|
+
* Resolves the reference against the base URL in scope at `node`, as recorded by the {@link xml} and {@link html}
|
|
90
|
+
* parsers, so that consumers always work on absolute IRIs, wherever the reference appears in the document. References
|
|
91
|
+
* are returned unresolved for computed values and for trees without a base URL, such as trees parsed from text
|
|
92
|
+
* without a `base` argument.
|
|
93
|
+
*
|
|
94
|
+
* @param node The {@link Target} to read, either a selected node or a computed value
|
|
95
|
+
*
|
|
96
|
+
* @returns The IRI written in the text of `node`, resolved against the base URL in scope at `node`, if any
|
|
97
|
+
*
|
|
98
|
+
* @throws {@link !TypeError TypeError} If the text of `node` is neither an IRI nor a relative reference
|
|
99
|
+
*
|
|
100
|
+
* @see {@link https://www.rfc-editor.org/rfc/rfc3987 RFC 3987 Internationalized Resource Identifiers}
|
|
101
|
+
* @see {@link https://www.w3.org/TR/xmlbase/ XML Base}
|
|
102
|
+
*/
|
|
103
|
+
export function link(node) {
|
|
104
|
+
const reference = string(node);
|
|
105
|
+
const url = base(node);
|
|
106
|
+
return assert(url === undefined ? reference : resolved(url), isIRI);
|
|
107
|
+
function resolved(url) {
|
|
108
|
+
try {
|
|
109
|
+
return new URL(reference, url).href;
|
|
110
|
+
}
|
|
111
|
+
catch { // a malformed reference is reported as it stands // !!! review leniency
|
|
112
|
+
return reference;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAY,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAe,MAAM,iBAAiB,CAAC;AAE7D,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAG5B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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Markdown } from "@grafctory/core/strings";
|
|
2
|
+
import type { AnyNode } from "domhandler";
|
|
3
|
+
/**
|
|
4
|
+
* Converts a markup tree to markdown text.
|
|
5
|
+
*
|
|
6
|
+
* Helper backing the `untag()` task, which states the conversion contract.
|
|
7
|
+
*/
|
|
8
|
+
export declare function process(node: AnyNode): Markdown;
|
|
9
|
+
//# sourceMappingURL=untag.core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"untag.core.d.ts","sourceRoot":"","sources":["../src/untag.core.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,KAAK,EAAE,OAAO,EAA6B,MAAM,YAAY,CAAC;AAkErE;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,OAAO,GAAG,QAAQ,CAmR/C"}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © 2026 Metreeca srl
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { escape } from "@grafctory/core/strings";
|
|
17
|
+
import { hasChildren, isComment, isTag, isText } from "domhandler";
|
|
18
|
+
import { name, normalize, text, title } from "./index.core.js";
|
|
19
|
+
import { base } from "./xpath.core.js";
|
|
20
|
+
/**
|
|
21
|
+
* The indentation each enclosing list beyond the outermost adds to an item.
|
|
22
|
+
*/
|
|
23
|
+
const Indent = " ";
|
|
24
|
+
/**
|
|
25
|
+
* The elements rendered as nothing.
|
|
26
|
+
*
|
|
27
|
+
* Lists the framing, the controls and the embedded objects a reader is after no text from, alongside the document
|
|
28
|
+
* metadata the frontmatter states instead, so that none of the rendering, the text a heading, emphasis or the
|
|
29
|
+
* frontmatter title is read as, and the content a link or an item is kept for draws text from them.
|
|
30
|
+
*
|
|
31
|
+
* Kept apart from the `Ignored` set the page scoring and the title search are pruned with: a name listed there in
|
|
32
|
+
* error only shifts a heuristic score, while one listed here deletes text from the rendering, so the two answer to
|
|
33
|
+
* different risks.
|
|
34
|
+
*/
|
|
35
|
+
const Dropped = new Set([
|
|
36
|
+
"head", "title", "style", "script", "noscript",
|
|
37
|
+
"nav", "header", "footer", "aside",
|
|
38
|
+
"menu", "menuitem", "toolbar",
|
|
39
|
+
"iframe", "embed", "object", "applet",
|
|
40
|
+
"form", "input", "button", "select", "textarea", "label", "fieldset", "legend",
|
|
41
|
+
"canvas", "svg", "audio", "video", "track", "source"
|
|
42
|
+
]);
|
|
43
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
44
|
+
/**
|
|
45
|
+
* Converts a markup tree to markdown text.
|
|
46
|
+
*
|
|
47
|
+
* Helper backing the `untag()` task, which states the conversion contract.
|
|
48
|
+
*/
|
|
49
|
+
export function process(node) {
|
|
50
|
+
const titled = title(node);
|
|
51
|
+
const url = located(node);
|
|
52
|
+
const body = format({ text: "", space: false, level: 0, item: false }, node).text.trim();
|
|
53
|
+
const front = [
|
|
54
|
+
...(titled === undefined ? [] : [`title: "${escape(plain(titled))}"`]),
|
|
55
|
+
...(url === undefined ? [] : [`url: "${escape(url.href)}"`])
|
|
56
|
+
];
|
|
57
|
+
return front.length === 0 ? body : `---\n${front.join("\n")}\n---\n\n${body}`.trim();
|
|
58
|
+
function located(node) {
|
|
59
|
+
return isTag(node) ? base(node)
|
|
60
|
+
: hasChildren(node) ? node.children.filter(isTag).map(base).find(url => url !== undefined)
|
|
61
|
+
: undefined;
|
|
62
|
+
}
|
|
63
|
+
function format(buffer, node) {
|
|
64
|
+
return isTag(node) ? tag(buffer, node)
|
|
65
|
+
: isText(node) ? append(buffer, normalize(node.data)) // bordering whitespace kept, lest words run together
|
|
66
|
+
: isComment(node) ? { ...buffer, space: true } // a boundary stated by the markup, likewise
|
|
67
|
+
: hasChildren(node) ? children(buffer, node)
|
|
68
|
+
: buffer; // doctypes and processing instructions carry no content
|
|
69
|
+
}
|
|
70
|
+
function children(buffer, node) {
|
|
71
|
+
return node.children.reduce((buffer, child, index) => {
|
|
72
|
+
const previous = node.children[index - 1];
|
|
73
|
+
// elements stated side by side are kept apart, as a comment between them would; text bordering an element
|
|
74
|
+
// is left as it stands, lest a word split across the two be broken apart
|
|
75
|
+
return format(previous !== undefined && isTag(previous) && isTag(child)
|
|
76
|
+
? { ...buffer, space: true }
|
|
77
|
+
: buffer, child);
|
|
78
|
+
}, buffer);
|
|
79
|
+
}
|
|
80
|
+
function tag(buffer, element) {
|
|
81
|
+
switch (name(element)) {
|
|
82
|
+
case "h1":
|
|
83
|
+
return heading(buffer, element, "#");
|
|
84
|
+
case "h2":
|
|
85
|
+
return heading(buffer, element, "##");
|
|
86
|
+
case "h3":
|
|
87
|
+
return heading(buffer, element, "###");
|
|
88
|
+
case "p":
|
|
89
|
+
case "section":
|
|
90
|
+
case "article":
|
|
91
|
+
return block(buffer, buffer => children(buffer, element));
|
|
92
|
+
case "div":
|
|
93
|
+
return paragraph(element)
|
|
94
|
+
? block(buffer, buffer => children(buffer, element))
|
|
95
|
+
: wrap(children(buffer, element));
|
|
96
|
+
case "ul":
|
|
97
|
+
case "ol":
|
|
98
|
+
return list(buffer, buffer => children(buffer, element));
|
|
99
|
+
case "li":
|
|
100
|
+
return rendered(element)
|
|
101
|
+
? wrap(children({ ...append(margin(wrap(buffer)), "- "), item: true }, element))
|
|
102
|
+
: buffer;
|
|
103
|
+
case "br":
|
|
104
|
+
return split(buffer);
|
|
105
|
+
case "hr":
|
|
106
|
+
return block(buffer, buffer => append(buffer, "---"));
|
|
107
|
+
case "a":
|
|
108
|
+
return rendered(element)
|
|
109
|
+
? append(clip(children(append(buffer, "["), element)), "](", resolve(attribute(element, "href"), element), ")")
|
|
110
|
+
: buffer;
|
|
111
|
+
case "img":
|
|
112
|
+
return append(buffer, ", element), ")");
|
|
113
|
+
case "strong":
|
|
114
|
+
case "b":
|
|
115
|
+
return emphasis(buffer, element, "**");
|
|
116
|
+
case "em":
|
|
117
|
+
case "i":
|
|
118
|
+
return emphasis(buffer, element, "*");
|
|
119
|
+
case "script": // JSON-LD metadata is content, whatever else a script carries is not
|
|
120
|
+
return attribute(element, "type") === "application/ld+json"
|
|
121
|
+
? block(buffer, buffer => append(buffer, "```json\n", plain(element), "\n```"))
|
|
122
|
+
: buffer;
|
|
123
|
+
default: // the framing, the controls and the embedded objects a reader is after no text from
|
|
124
|
+
return Dropped.has(name(element)) ? buffer : children(buffer, element);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function append(buffer, ...strings) {
|
|
128
|
+
return [...strings.join("")].reduce(write, buffer);
|
|
129
|
+
function write(buffer, char) {
|
|
130
|
+
const { text, space } = buffer;
|
|
131
|
+
return char === " " || char === "\t" ? { ...buffer, space: true } // withheld until content follows it
|
|
132
|
+
: char === "\r" ? { ...buffer, space: false }
|
|
133
|
+
: char === "\n" ? { ...buffer, text: `${text}\n`, space: false }
|
|
134
|
+
: {
|
|
135
|
+
...buffer,
|
|
136
|
+
text: space && !opening(text) ? `${text} ${char}` : `${text}${char}`,
|
|
137
|
+
space: false,
|
|
138
|
+
item: false // the line has taken the content its marker opened it for
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function opening(text) {
|
|
142
|
+
const last = text.charAt(text.length - 1);
|
|
143
|
+
return last === "" || last === "\n" || last === " ";
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
function block(buffer, content) {
|
|
147
|
+
return feed(content(feed(buffer)));
|
|
148
|
+
}
|
|
149
|
+
function clip(buffer) {
|
|
150
|
+
return { ...buffer, space: false };
|
|
151
|
+
}
|
|
152
|
+
// a line opening an item is left as it stands, so that the content of the item lands on it rather than below it
|
|
153
|
+
function feed(buffer) {
|
|
154
|
+
return buffer.item ? buffer : padded(wrap(buffer));
|
|
155
|
+
}
|
|
156
|
+
function padded(buffer) {
|
|
157
|
+
const { text } = buffer;
|
|
158
|
+
return { ...buffer, text: text.length > 2 && text.charAt(text.length - 2) !== "\n" ? `${text}\n` : text };
|
|
159
|
+
}
|
|
160
|
+
function wrap(buffer) {
|
|
161
|
+
const { text } = buffer;
|
|
162
|
+
return buffer.item ? buffer
|
|
163
|
+
: { ...buffer, text: text.length > 1 && !text.endsWith("\n") ? `${text}\n` : text, space: false };
|
|
164
|
+
}
|
|
165
|
+
function split(buffer) {
|
|
166
|
+
const { text } = buffer;
|
|
167
|
+
return buffer.item ? buffer
|
|
168
|
+
: { ...buffer, text: text.length > 0 && !text.endsWith("\n\n") ? `${text}\n` : text, space: false };
|
|
169
|
+
}
|
|
170
|
+
function list(buffer, content) {
|
|
171
|
+
const { level } = buffer;
|
|
172
|
+
// the outermost list opens a block of its own
|
|
173
|
+
const opened = { ...(level === 0 ? feed(buffer) : buffer), level: level + 1 };
|
|
174
|
+
return { ...feed(content(opened)), level };
|
|
175
|
+
}
|
|
176
|
+
function margin(buffer) {
|
|
177
|
+
const { text, level } = buffer;
|
|
178
|
+
return buffer.item ? buffer : { ...buffer, text: `${text}${Indent.repeat(Math.max(level - 1, 0))}` };
|
|
179
|
+
}
|
|
180
|
+
function paragraph(element) {
|
|
181
|
+
const content = element.children.filter(node => !isText(node) || node.data.trim().length > 0);
|
|
182
|
+
return content.some(isText) // text of its own, mixed with elements or not
|
|
183
|
+
|| content.length === 1 && content.every(isTag); // a lone element standing in for the text
|
|
184
|
+
}
|
|
185
|
+
function heading(buffer, element, marker) {
|
|
186
|
+
const content = plain(element);
|
|
187
|
+
// a heading carrying no text leaves no marker behind
|
|
188
|
+
return content === "" ? buffer : block(buffer, buffer => append(buffer, marker, " ", content));
|
|
189
|
+
}
|
|
190
|
+
function emphasis(buffer, element, marker) {
|
|
191
|
+
const spaced = normalize(text(element, Dropped));
|
|
192
|
+
const content = spaced.trim();
|
|
193
|
+
// whitespace bordering the content is written outside the markers, as CommonMark reads no emphasis from
|
|
194
|
+
// markers padded with it; emphasis carrying no text leaves no markers behind, but stands for the space it holds
|
|
195
|
+
return content === "" ? { ...buffer, space: buffer.space || spaced.length > 0 }
|
|
196
|
+
: append(buffer, spaced.startsWith(" ") ? " " : "", marker, content, marker, spaced.endsWith(" ") ? " " : "");
|
|
197
|
+
}
|
|
198
|
+
function rendered(element) {
|
|
199
|
+
return element.children.some(function shown(node) {
|
|
200
|
+
return isText(node) ? node.data.trim() !== ""
|
|
201
|
+
: !isTag(node) ? false
|
|
202
|
+
: name(node) === "img" ? true
|
|
203
|
+
: Dropped.has(name(node)) ? false
|
|
204
|
+
: node.children.some(shown);
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
// a heading, emphasis and the frontmatter title are read as the text left once the dropped elements are taken out,
|
|
208
|
+
// so that the caption of a control doesn't reach them through the prose enclosing it
|
|
209
|
+
function plain(element) {
|
|
210
|
+
return normalize(text(element, Dropped).trim());
|
|
211
|
+
}
|
|
212
|
+
function attribute(element, name) {
|
|
213
|
+
return element.attribs[name] ?? "";
|
|
214
|
+
}
|
|
215
|
+
function resolve(reference, element) {
|
|
216
|
+
return reference === "" ? reference : URL.parse(reference, base(element))?.href ?? reference;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
//# sourceMappingURL=untag.core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"untag.core.js","sourceRoot":"","sources":["../src/untag.core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAA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AAqF;IAErF,SAAS,KAAK,CAAC,OAAgB;QAC9B,OAAO,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACjD,CAAC;IAED,SAAS,SAAS,CAAC,OAAgB,EAAE,IAAY;QAChD,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IACpC,CAAC;IAED,SAAS,OAAO,CAAC,SAAiB,EAAE,OAAgB;QACnD,OAAO,SAAS,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,IAAI,SAAS,CAAC;IAC9F,CAAC;AAEF,CAAC"}
|
package/dist/untag.d.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { Markdown } from "@grafctory/core/strings";
|
|
2
|
+
import type { Task } from "@grafctory/flow";
|
|
3
|
+
import type { AnyNode } from "domhandler";
|
|
4
|
+
/**
|
|
5
|
+
* Creates a Markdown renderer.
|
|
6
|
+
*
|
|
7
|
+
* The task converts a feed of parsed X/HTML trees into a feed of Markdown text, one rendering per tree, so that
|
|
8
|
+
* consumers of prose, such as language models, work on text rather than on markup.
|
|
9
|
+
*
|
|
10
|
+
* Trees without content, title or base URL are rendered as an empty string, so that renderings stay aligned with the
|
|
11
|
+
* input feed.
|
|
12
|
+
*
|
|
13
|
+
* If a tree has a title or a base URL, its rendering opens with a YAML frontmatter block holding them as `title` and
|
|
14
|
+
* `url`. Values are written as quoted scalars, so that punctuation in headlines or query strings can't break the
|
|
15
|
+
* block. Fields without a value are omitted.
|
|
16
|
+
*
|
|
17
|
+
* The title is the first `title` element outside page framing, so that captions of embedded objects are not mistaken
|
|
18
|
+
* for it; a title without text is ignored. The base URL is the one recorded on the root element of the tree, or on the
|
|
19
|
+
* first root element of a document; a base URL that doesn't resolve to an absolute URL is ignored.
|
|
20
|
+
*
|
|
21
|
+
* Elements are rendered as follows, with names matched case-insensitively:
|
|
22
|
+
*
|
|
23
|
+
* - `h1`, `h2`, `h3` — a heading of the matching level, set off by blank lines; omitted if it has no text
|
|
24
|
+
* - `p`, `section`, `article` — the content, set off by blank lines
|
|
25
|
+
* - `div` — the content, set off by blank lines if the element has text of its own or wraps a single element, and
|
|
26
|
+
* followed by a line break otherwise, so that fields read as paragraphs while layout wrappers don't split content
|
|
27
|
+
* into separate blocks
|
|
28
|
+
* - `ul`, `ol` — a list, set off by blank lines; ordered lists are rendered as unordered ones
|
|
29
|
+
* - `li` — an item marked with `-` and indented by two spaces for each enclosing list beyond the outermost; its content
|
|
30
|
+
* starts on the marker line; omitted if it has neither text nor images
|
|
31
|
+
* - `br` — a line break; two or more consecutive breaks produce a single blank line, and breaks at the start of the
|
|
32
|
+
* text are dropped
|
|
33
|
+
* - `hr` — a thematic break, set off by blank lines
|
|
34
|
+
* - `a` — a link to the `href` target, labelled by the content; omitted if it has neither text nor images
|
|
35
|
+
* - `img` — an image reference to the `src` target, labelled by the `alt` text
|
|
36
|
+
* - `strong`, `b` — strong emphasis; surrounding whitespace is moved outside the markers, so that they are read as
|
|
37
|
+
* emphasis rather than as text; omitted if it has no text, though its whitespace is kept
|
|
38
|
+
* - `em`, `i` — emphasis, rendered like strong emphasis
|
|
39
|
+
* - `script` — a fenced `json` block set off by blank lines, if the type is `application/ld+json`; nothing otherwise
|
|
40
|
+
* - `head`, `title`, `style`, `noscript` — nothing; the title is rendered in the frontmatter instead
|
|
41
|
+
* - `nav`, `header`, `footer`, `aside`, `menu`, `menuitem`, `toolbar` — nothing, including all their content, so that
|
|
42
|
+
* page framing leaves no text behind
|
|
43
|
+
* - `form`, `input`, `button`, `select`, `textarea`, `label`, `fieldset`, `legend` — nothing, including all their
|
|
44
|
+
* content, so that controls and their captions leave no text behind
|
|
45
|
+
* - `iframe`, `embed`, `object`, `applet`, `canvas`, `svg`, `audio`, `video`, `track`, `source` — nothing, including
|
|
46
|
+
* all their content, so that embedded objects leave no text behind
|
|
47
|
+
*
|
|
48
|
+
* All other elements, including the `html` and `body` page wrappers, are rendered as their content. Content rendered
|
|
49
|
+
* as nothing doesn't count when deciding whether links and items have text, so decorative links leave no empty labels
|
|
50
|
+
* behind. It is also excluded from the text of headings, emphasis and the frontmatter title, so that captions of
|
|
51
|
+
* controls and graphics don't leak into the surrounding prose.
|
|
52
|
+
*
|
|
53
|
+
* Link and image targets, fragment references included, are resolved against the base URL in scope at their element,
|
|
54
|
+
* so that a rendering stored or displayed away from its source page still leads back to it. A target that doesn't
|
|
55
|
+
* resolve to an absolute URL is kept as stated, as happens in trees without a base URL. An empty target stays empty.
|
|
56
|
+
*
|
|
57
|
+
* > [!IMPORTANT]
|
|
58
|
+
* >
|
|
59
|
+
* > Pages holding their content inside a form, such as filtered listings or pages wrapped in a server-side form, are
|
|
60
|
+
* > rendered without that content, possibly as an empty string. For such pages, select the region to render with an
|
|
61
|
+
* > {@link xpath} expression reaching inside the form; {@link focus} also treats forms as framing.
|
|
62
|
+
*
|
|
63
|
+
* In text, runs of spaces, control characters and typographic separators (including no-break spaces) are collapsed to
|
|
64
|
+
* a single space. Whitespace at the edges of a text node is kept, so that emphasis misplaced with respect to the
|
|
65
|
+
* surrounding spaces doesn't run words together. Comments are rendered as a space, so that words separated only by
|
|
66
|
+
* framework markers or adjacent fields stay apart. Text directly adjacent to an element is joined to it without a
|
|
67
|
+
* space, so that words split across element boundaries stay whole. Lines never start with a space, link labels never
|
|
68
|
+
* end with one, and each rendering is trimmed.
|
|
69
|
+
*
|
|
70
|
+
* > [!NOTE]
|
|
71
|
+
* >
|
|
72
|
+
* > - **Incremental**: each rendering is emitted as soon as its tree is drawn, so endless sources are processed for as
|
|
73
|
+
* > long as the feed is consumed.
|
|
74
|
+
* > - **Streaming**: trees are processed one at a time and released once rendered, so memory use doesn't grow with the
|
|
75
|
+
* > length of the feed.
|
|
76
|
+
* > - **Stateless**: each tree is rendered independently, so the result doesn't depend on how the feed is split across
|
|
77
|
+
* > nested feeds or runs.
|
|
78
|
+
*
|
|
79
|
+
* @returns A task converting a feed of parsed X/HTML trees into a feed of Markdown text
|
|
80
|
+
*
|
|
81
|
+
* @throws {@link !Error Error} While the feed is consumed, if the source feed fails
|
|
82
|
+
*
|
|
83
|
+
* @see {@link https://spec.commonmark.org/ CommonMark Spec}
|
|
84
|
+
* @see {@link https://json-ld.org/ JSON-LD}
|
|
85
|
+
* @see {@link https://www.w3.org/TR/xmlbase/ XML Base}
|
|
86
|
+
*
|
|
87
|
+
* @group Factories
|
|
88
|
+
*/
|
|
89
|
+
export declare function untag(): Task<AnyNode, Markdown>;
|
|
90
|
+
//# sourceMappingURL=untag.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"untag.d.ts","sourceRoot":"","sources":["../src/untag.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAI1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoFG;AACH,wBAAgB,KAAK,IAAI,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAI/C"}
|
package/dist/untag.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © 2026 Metreeca srl
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { map } from "@grafctory/flow/tasks";
|
|
17
|
+
import { process } from "./untag.core.js";
|
|
18
|
+
/**
|
|
19
|
+
* Creates a Markdown renderer.
|
|
20
|
+
*
|
|
21
|
+
* The task converts a feed of parsed X/HTML trees into a feed of Markdown text, one rendering per tree, so that
|
|
22
|
+
* consumers of prose, such as language models, work on text rather than on markup.
|
|
23
|
+
*
|
|
24
|
+
* Trees without content, title or base URL are rendered as an empty string, so that renderings stay aligned with the
|
|
25
|
+
* input feed.
|
|
26
|
+
*
|
|
27
|
+
* If a tree has a title or a base URL, its rendering opens with a YAML frontmatter block holding them as `title` and
|
|
28
|
+
* `url`. Values are written as quoted scalars, so that punctuation in headlines or query strings can't break the
|
|
29
|
+
* block. Fields without a value are omitted.
|
|
30
|
+
*
|
|
31
|
+
* The title is the first `title` element outside page framing, so that captions of embedded objects are not mistaken
|
|
32
|
+
* for it; a title without text is ignored. The base URL is the one recorded on the root element of the tree, or on the
|
|
33
|
+
* first root element of a document; a base URL that doesn't resolve to an absolute URL is ignored.
|
|
34
|
+
*
|
|
35
|
+
* Elements are rendered as follows, with names matched case-insensitively:
|
|
36
|
+
*
|
|
37
|
+
* - `h1`, `h2`, `h3` — a heading of the matching level, set off by blank lines; omitted if it has no text
|
|
38
|
+
* - `p`, `section`, `article` — the content, set off by blank lines
|
|
39
|
+
* - `div` — the content, set off by blank lines if the element has text of its own or wraps a single element, and
|
|
40
|
+
* followed by a line break otherwise, so that fields read as paragraphs while layout wrappers don't split content
|
|
41
|
+
* into separate blocks
|
|
42
|
+
* - `ul`, `ol` — a list, set off by blank lines; ordered lists are rendered as unordered ones
|
|
43
|
+
* - `li` — an item marked with `-` and indented by two spaces for each enclosing list beyond the outermost; its content
|
|
44
|
+
* starts on the marker line; omitted if it has neither text nor images
|
|
45
|
+
* - `br` — a line break; two or more consecutive breaks produce a single blank line, and breaks at the start of the
|
|
46
|
+
* text are dropped
|
|
47
|
+
* - `hr` — a thematic break, set off by blank lines
|
|
48
|
+
* - `a` — a link to the `href` target, labelled by the content; omitted if it has neither text nor images
|
|
49
|
+
* - `img` — an image reference to the `src` target, labelled by the `alt` text
|
|
50
|
+
* - `strong`, `b` — strong emphasis; surrounding whitespace is moved outside the markers, so that they are read as
|
|
51
|
+
* emphasis rather than as text; omitted if it has no text, though its whitespace is kept
|
|
52
|
+
* - `em`, `i` — emphasis, rendered like strong emphasis
|
|
53
|
+
* - `script` — a fenced `json` block set off by blank lines, if the type is `application/ld+json`; nothing otherwise
|
|
54
|
+
* - `head`, `title`, `style`, `noscript` — nothing; the title is rendered in the frontmatter instead
|
|
55
|
+
* - `nav`, `header`, `footer`, `aside`, `menu`, `menuitem`, `toolbar` — nothing, including all their content, so that
|
|
56
|
+
* page framing leaves no text behind
|
|
57
|
+
* - `form`, `input`, `button`, `select`, `textarea`, `label`, `fieldset`, `legend` — nothing, including all their
|
|
58
|
+
* content, so that controls and their captions leave no text behind
|
|
59
|
+
* - `iframe`, `embed`, `object`, `applet`, `canvas`, `svg`, `audio`, `video`, `track`, `source` — nothing, including
|
|
60
|
+
* all their content, so that embedded objects leave no text behind
|
|
61
|
+
*
|
|
62
|
+
* All other elements, including the `html` and `body` page wrappers, are rendered as their content. Content rendered
|
|
63
|
+
* as nothing doesn't count when deciding whether links and items have text, so decorative links leave no empty labels
|
|
64
|
+
* behind. It is also excluded from the text of headings, emphasis and the frontmatter title, so that captions of
|
|
65
|
+
* controls and graphics don't leak into the surrounding prose.
|
|
66
|
+
*
|
|
67
|
+
* Link and image targets, fragment references included, are resolved against the base URL in scope at their element,
|
|
68
|
+
* so that a rendering stored or displayed away from its source page still leads back to it. A target that doesn't
|
|
69
|
+
* resolve to an absolute URL is kept as stated, as happens in trees without a base URL. An empty target stays empty.
|
|
70
|
+
*
|
|
71
|
+
* > [!IMPORTANT]
|
|
72
|
+
* >
|
|
73
|
+
* > Pages holding their content inside a form, such as filtered listings or pages wrapped in a server-side form, are
|
|
74
|
+
* > rendered without that content, possibly as an empty string. For such pages, select the region to render with an
|
|
75
|
+
* > {@link xpath} expression reaching inside the form; {@link focus} also treats forms as framing.
|
|
76
|
+
*
|
|
77
|
+
* In text, runs of spaces, control characters and typographic separators (including no-break spaces) are collapsed to
|
|
78
|
+
* a single space. Whitespace at the edges of a text node is kept, so that emphasis misplaced with respect to the
|
|
79
|
+
* surrounding spaces doesn't run words together. Comments are rendered as a space, so that words separated only by
|
|
80
|
+
* framework markers or adjacent fields stay apart. Text directly adjacent to an element is joined to it without a
|
|
81
|
+
* space, so that words split across element boundaries stay whole. Lines never start with a space, link labels never
|
|
82
|
+
* end with one, and each rendering is trimmed.
|
|
83
|
+
*
|
|
84
|
+
* > [!NOTE]
|
|
85
|
+
* >
|
|
86
|
+
* > - **Incremental**: each rendering is emitted as soon as its tree is drawn, so endless sources are processed for as
|
|
87
|
+
* > long as the feed is consumed.
|
|
88
|
+
* > - **Streaming**: trees are processed one at a time and released once rendered, so memory use doesn't grow with the
|
|
89
|
+
* > length of the feed.
|
|
90
|
+
* > - **Stateless**: each tree is rendered independently, so the result doesn't depend on how the feed is split across
|
|
91
|
+
* > nested feeds or runs.
|
|
92
|
+
*
|
|
93
|
+
* @returns A task converting a feed of parsed X/HTML trees into a feed of Markdown text
|
|
94
|
+
*
|
|
95
|
+
* @throws {@link !Error Error} While the feed is consumed, if the source feed fails
|
|
96
|
+
*
|
|
97
|
+
* @see {@link https://spec.commonmark.org/ CommonMark Spec}
|
|
98
|
+
* @see {@link https://json-ld.org/ JSON-LD}
|
|
99
|
+
* @see {@link https://www.w3.org/TR/xmlbase/ XML Base}
|
|
100
|
+
*
|
|
101
|
+
* @group Factories
|
|
102
|
+
*/
|
|
103
|
+
export function untag() {
|
|
104
|
+
return map(process);
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=untag.js.map
|