Skip to content

Commit d455aee

Browse files
committed
fix: 🐛 Removed parsing all attributes and support added for specific attributes
1 parent 35be550 commit d455aee

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

src/options/default-node-options.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,73 +9,73 @@ export const defaultNodeOption: RenderOption = {
99
return ``
1010
},
1111
[NodeType.PARAGRAPH]:(node: Node, next: Next) => {
12-
return `<p${attributeToString(node.attrs)}>${next(node.children)}</p>`
12+
return `<p>${next(node.children)}</p>`
1313
},
1414
[NodeType.LINK]:(node: Node, next: Next) => {
15-
return `<a${attributeToString(node.attrs)}>${next(node.children)}</a>`
15+
return `<a href="${node.attrs.url}">${next(node.children)}</a>`
1616
},
1717
[NodeType.IMAGE]:(node: Node, next: Next) => {
18-
return `<img${attributeToString(node.attrs)} />${next(node.children)}`
18+
return `<img src="${node.attrs.url}" />${next(node.children)}`
1919
},
2020
[NodeType.EMBED]:(node: Node, next: Next) => {
21-
return `<iframe${attributeToString(node.attrs)}>${next(node.children)}</iframe>`
21+
return `<iframe src="${node.attrs.url}">${next(node.children)}</iframe>`
2222
},
2323
[NodeType.HEADING_1]:(node: Node, next: Next) => {
24-
return `<h1${attributeToString(node.attrs)}>${next(node.children)}</h1>`
24+
return `<h1>${next(node.children)}</h1>`
2525
},
2626
[NodeType.HEADING_2]:(node: Node, next: Next) => {
27-
return `<h2${attributeToString(node.attrs)}>${next(node.children)}</h2>`
27+
return `<h2>${next(node.children)}</h2>`
2828
},
2929
[NodeType.HEADING_3]:(node: Node, next: Next) => {
30-
return `<h3${attributeToString(node.attrs)}>${next(node.children)}</h3>`
30+
return `<h3>${next(node.children)}</h3>`
3131
},
3232
[NodeType.HEADING_4]:(node: Node, next: Next) => {
33-
return `<h4${attributeToString(node.attrs)}>${next(node.children)}</h4>`
33+
return `<h4>${next(node.children)}</h4>`
3434
},
3535
[NodeType.HEADING_5]:(node: Node, next: Next) => {
36-
return `<h5${attributeToString(node.attrs)}>${next(node.children)}</h5>`
36+
return `<h5>${next(node.children)}</h5>`
3737
},
3838
[NodeType.HEADING_6]:(node: Node, next: Next) => {
39-
return `<h6${attributeToString(node.attrs)}>${next(node.children)}</h6>`
39+
return `<h6>${next(node.children)}</h6>`
4040
},
4141
[NodeType.ORDER_LIST]:(node: Node, next: Next) => {
42-
return `<ol${attributeToString(node.attrs)}>${next(node.children)}</ol>`
42+
return `<ol>${next(node.children)}</ol>`
4343
},
4444
[NodeType.UNORDER_LIST]:(node: Node, next: Next) => {
45-
return `<ul${attributeToString(node.attrs)}>${next(node.children)}</ul>`
45+
return `<ul>${next(node.children)}</ul>`
4646
},
4747
[NodeType.LIST_ITEM]:(node: Node, next: Next) => {
48-
return `<li${attributeToString(node.attrs)}>${next(node.children)}</li>`
48+
return `<li>${next(node.children)}</li>`
4949
},
5050
[NodeType.HR]:(node: Node, next: Next) => {
5151
return `<hr>`
5252
},
5353
[NodeType.TABLE]:(node: Node, next: Next) => {
54-
return `<table${attributeToString(node.attrs)}>${next(node.children)}</table>`
54+
return `<table>${next(node.children)}</table>`
5555
},
5656
[NodeType.TABLE_HEADER]:(node: Node, next: Next) => {
57-
return `<thead${attributeToString(node.attrs)}>${next(node.children)}</thead>`
57+
return `<thead>${next(node.children)}</thead>`
5858
},
5959
[NodeType.TABLE_BODY]:(node: Node, next: Next) => {
60-
return `<tbody${attributeToString(node.attrs)}>${next(node.children)}</tbody>`
60+
return `<tbody>${next(node.children)}</tbody>`
6161
},
6262
[NodeType.TABLE_FOOTER]:(node: Node, next: Next) => {
63-
return `<tfoot${attributeToString(node.attrs)}>${next(node.children)}</tfoot>`
63+
return `<tfoot>${next(node.children)}</tfoot>`
6464
},
6565
[NodeType.TABLE_ROW]:(node: Node, next: Next) => {
66-
return `<tr${attributeToString(node.attrs)}>${next(node.children)}</tr>`
66+
return `<tr>${next(node.children)}</tr>`
6767
},
6868
[NodeType.TABLE_HEAD]:(node: Node, next: Next) => {
69-
return `<th${attributeToString(node.attrs)}>${next(node.children)}</th>`
69+
return `<th>${next(node.children)}</th>`
7070
},
7171
[NodeType.TABLE_DATA]:(node: Node, next: Next) => {
72-
return `<td${attributeToString(node.attrs)}>${next(node.children)}</td>`
72+
return `<td>${next(node.children)}</td>`
7373
},
7474
[NodeType.BLOCK_QUOTE]:(node: Node, next: Next) => {
75-
return `<blockquote${attributeToString(node.attrs)}>${next(node.children)}</blockquote>`
75+
return `<blockquote>${next(node.children)}</blockquote>`
7676
},
7777
[NodeType.CODE]:(node: Node, next: Next) => {
78-
return `<code${attributeToString(node.attrs)}>${next(node.children)}</code>`
78+
return `<code>${next(node.children)}</code>`
7979
},
8080

8181
['reference']:(node: Node, next: Next) => {

0 commit comments

Comments
 (0)