Skip to content

Commit 5082487

Browse files
committed
chore: format markdown renderer files
1 parent a7f6363 commit 5082487

2 files changed

Lines changed: 36 additions & 9 deletions

File tree

src/markdown.ts

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,18 +146,43 @@ function orderedItem(line: string): string | null {
146146

147147
// Allowed HTML tags for task markdown fragments
148148
const ALLOWED_TAGS = new Set([
149-
"section", "div", "span", "p", "br", "hr",
150-
"h1", "h2", "h3", "h4", "h5", "h6",
151-
"ul", "ol", "li",
152-
"strong", "em", "b", "i", "u", "s",
153-
"code", "pre",
154-
"a", "img",
155-
"table", "thead", "tbody", "tr", "th", "td",
149+
"section",
150+
"div",
151+
"span",
152+
"p",
153+
"br",
154+
"hr",
155+
"h1",
156+
"h2",
157+
"h3",
158+
"h4",
159+
"h5",
160+
"h6",
161+
"ul",
162+
"ol",
163+
"li",
164+
"strong",
165+
"em",
166+
"b",
167+
"i",
168+
"u",
169+
"s",
170+
"code",
171+
"pre",
172+
"a",
173+
"img",
174+
"table",
175+
"thead",
176+
"tbody",
177+
"tr",
178+
"th",
179+
"td",
156180
"blockquote",
157181
]);
158182

159183
// Dangerous tag patterns that indicate potential script injection
160-
const DANGEROUS_TAGS = /^(script|iframe|object|embed|form|input|button|select|textarea|style|link|meta)$/i;
184+
const DANGEROUS_TAGS =
185+
/^(script|iframe|object|embed|form|input|button|select|textarea|style|link|meta)$/i;
161186

162187
// Dangerous attribute patterns
163188
const DANGEROUS_ATTR_PATTERN = /^(on\w+|style|href|src)$/i;

tests/markdown.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ describe("Taskr Markdown renderer", () => {
4949
});
5050

5151
it("removes dangerous attributes like onclick while preserving safe ones", () => {
52-
const html = renderMarkdownHtml('<div class="test" onclick="alert(1)" style="color:red">Content</div>');
52+
const html = renderMarkdownHtml(
53+
'<div class="test" onclick="alert(1)" style="color:red">Content</div>',
54+
);
5355
expect(html).toContain('class="test"');
5456
expect(html).not.toContain("onclick");
5557
expect(html).not.toContain("style");

0 commit comments

Comments
 (0)