Skip to content

Commit 13b4457

Browse files
fix: address review feedback from allozaur
1 parent b504f80 commit 13b4457

File tree

5 files changed

+28
-17
lines changed

5 files changed

+28
-17
lines changed

tools/server/webui/package-lock.json

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tools/server/webui/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"eslint-plugin-svelte": "^3.0.0",
5353
"fflate": "^0.8.2",
5454
"globals": "^16.0.0",
55+
"mdast": "^3.0.0",
5556
"mdsvex": "^0.12.3",
5657
"playwright": "^1.53.0",
5758
"prettier": "^3.4.2",
@@ -68,6 +69,7 @@
6869
"tw-animate-css": "^1.3.5",
6970
"typescript": "^5.0.0",
7071
"typescript-eslint": "^8.20.0",
72+
"unified": "^11.0.5",
7173
"uuid": "^13.0.0",
7274
"vite": "^7.0.4",
7375
"vite-plugin-devtools-json": "^0.2.0",

tools/server/webui/src/lib/components/app/misc/MarkdownContent.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import githubDarkCss from 'highlight.js/styles/github-dark.css?inline';
1515
import githubLightCss from 'highlight.js/styles/github.css?inline';
1616
import { mode } from 'mode-watcher';
17-
import { remarkLiteralHtml } from '$lib/markdown/literalHtml';
17+
import { remarkLiteralHtml } from '$lib/markdown/literal-html';
1818
1919
interface Props {
2020
content: string;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
export const LINE_BREAK = /\r?\n/;
2+
3+
export const PHRASE_PARENTS = new Set([
4+
'paragraph',
5+
'heading',
6+
'emphasis',
7+
'strong',
8+
'delete',
9+
'link',
10+
'linkReference',
11+
'tableCell'
12+
]);
13+
14+
export const NBSP = '\u00a0';
15+
export const TAB_AS_SPACES = NBSP.repeat(4);

tools/server/webui/src/lib/markdown/literalHtml.ts renamed to tools/server/webui/src/lib/markdown/literal-html.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { Plugin } from 'unified';
22
import { visit } from 'unist-util-visit';
33
import type { Break, Content, Paragraph, PhrasingContent, Root, Text } from 'mdast';
4+
import { LINE_BREAK, NBSP, PHRASE_PARENTS, TAB_AS_SPACES } from '$lib/constants/literal-html';
45

56
/**
67
* remark plugin that rewrites raw HTML nodes into plain-text equivalents.
@@ -12,22 +13,6 @@ import type { Break, Content, Paragraph, PhrasingContent, Root, Text } from 'mda
1213
* keep indentation identical to the original author input.
1314
*/
1415

15-
const LINE_BREAK = /\r?\n/;
16-
17-
const PHRASE_PARENTS = new Set([
18-
'paragraph',
19-
'heading',
20-
'emphasis',
21-
'strong',
22-
'delete',
23-
'link',
24-
'linkReference',
25-
'tableCell'
26-
]);
27-
28-
const NBSP = '\u00a0';
29-
const TAB_AS_SPACES = NBSP.repeat(4);
30-
3116
function preserveIndent(line: string): string {
3217
let index = 0;
3318
let output = '';

0 commit comments

Comments
 (0)