@opendikw/web-ui 0.1.2 → 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/README.md +11 -0
- package/dist/reader/markdown-runtime.js +12 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -21,6 +21,17 @@ and chart engines and uses KaTeX CSS/fonts through the application's bundler.
|
|
|
21
21
|
Callers provide their own labels, routes and API connection. The package has no
|
|
22
22
|
workbench translations or MB business models.
|
|
23
23
|
|
|
24
|
+
The reader accepts attribute-free `<sup>` and `<sub>` pairs (case-insensitive)
|
|
25
|
+
on one line, containing text or inline Markdown. Attributes, nested raw HTML and
|
|
26
|
+
unbalanced pairs remain escaped; code spans and fences retain literal tags.
|
|
27
|
+
Raw HTML tables also retain `sup`, `sub`, `i`, `em`, `b` and `strong` with all
|
|
28
|
+
their attributes stripped. Other elements are unwrapped after sanitizing their
|
|
29
|
+
children so scientific values and labels survive as inert text. Heading outlines
|
|
30
|
+
and anchors omit accepted tags while retaining their content. Existing imported
|
|
31
|
+
sources require no reconversion. The repository's
|
|
32
|
+
`tests/fixtures/scientific-markdown.json` is shared by regression, workbench e2e
|
|
33
|
+
and independent packed/registry consumer checks and can be reused downstream.
|
|
34
|
+
|
|
24
35
|
`useTheme({ storageKey })` returns `preference`, `resolved` and `setPreference`.
|
|
25
36
|
It applies the resolved theme, follows OS changes for `system`, and persists an
|
|
26
37
|
explicit selection to that application's key. Mounting does not overwrite a
|
|
@@ -11,7 +11,7 @@ import katex from "katex";
|
|
|
11
11
|
import "katex/dist/katex.min.css";
|
|
12
12
|
import MarkdownIt from "markdown-it";
|
|
13
13
|
import { useEffect } from "react";
|
|
14
|
-
import { parseDetailsOpenAttribute, rawDetailsPattern, uniqueHeadingSlug, } from "@opendikw/web-client/document";
|
|
14
|
+
import { installScientificInline, parseDetailsOpenAttribute, rawDetailsPattern, uniqueHeadingSlug, } from "@opendikw/web-client/document";
|
|
15
15
|
import { buildChartOption, isChartSpec, isChartType, parseChartFromDetails, } from "./chart-spec.js";
|
|
16
16
|
import { buildRequestUrl } from "@opendikw/web-client/core";
|
|
17
17
|
import { basename } from "@opendikw/web-client/document";
|
|
@@ -22,6 +22,7 @@ const markdown = new MarkdownIt({
|
|
|
22
22
|
typographer: true,
|
|
23
23
|
});
|
|
24
24
|
installWikiLinks(markdown);
|
|
25
|
+
installScientificInline(markdown);
|
|
25
26
|
installMath(markdown);
|
|
26
27
|
installObsidianImages(markdown);
|
|
27
28
|
installStandardImages(markdown);
|
|
@@ -323,6 +324,12 @@ const allowedTableTags = new Set([
|
|
|
323
324
|
"colgroup",
|
|
324
325
|
"col",
|
|
325
326
|
"br",
|
|
327
|
+
"sup",
|
|
328
|
+
"sub",
|
|
329
|
+
"i",
|
|
330
|
+
"em",
|
|
331
|
+
"b",
|
|
332
|
+
"strong",
|
|
326
333
|
]);
|
|
327
334
|
const allowedTableAttributes = new Set(["align", "colspan", "rowspan", "scope"]);
|
|
328
335
|
function extractSafeDetails(body, ctx) {
|
|
@@ -418,15 +425,15 @@ function sanitizeRawTable(raw) {
|
|
|
418
425
|
function sanitizeTableElement(element) {
|
|
419
426
|
for (const child of Array.from(element.children)) {
|
|
420
427
|
const tagName = child.tagName.toLowerCase();
|
|
428
|
+
sanitizeTableElement(child);
|
|
421
429
|
if (!allowedTableTags.has(tagName)) {
|
|
422
|
-
child.
|
|
423
|
-
continue;
|
|
430
|
+
child.replaceWith(...Array.from(child.childNodes));
|
|
424
431
|
}
|
|
425
|
-
sanitizeTableElement(child);
|
|
426
432
|
}
|
|
427
433
|
for (const attribute of Array.from(element.attributes)) {
|
|
428
434
|
const name = attribute.name.toLowerCase();
|
|
429
|
-
if (
|
|
435
|
+
if (!allowedTableAttributes.has(name) ||
|
|
436
|
+
!/^(?:table|th|td|col|colgroup)$/.test(element.tagName.toLowerCase())) {
|
|
430
437
|
element.removeAttribute(attribute.name);
|
|
431
438
|
}
|
|
432
439
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opendikw/web-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"access": "public"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@opendikw/web-client": "0.1.
|
|
64
|
+
"@opendikw/web-client": "0.1.3",
|
|
65
65
|
"lucide-react": "1.49.0",
|
|
66
66
|
"markdown-it": "15.0.2",
|
|
67
67
|
"katex": "0.18.9",
|