@@ -10,6 +10,13 @@ export const defaultNodeOption: RenderOption = {
1010 [ NodeType . PARAGRAPH ] :( node : Node , next : Next ) => {
1111 return `<p${ addStyleAttrs ( node . attrs . style ) } >${ next ( node . children ) } </p>`
1212 } ,
13+ // [NodeType.PARAGRAPH]:(node: Node, next: Next) => {
14+ // return `<p${addStyleAttrs(node.attrs.style)}>${next(node.children)}</p>`
15+ // },
16+ // [NodeType.PARAGRAPH]: (node: Node, next: Next) => {
17+ // const child = node.children.find((child) => child.classname)
18+ // return `<p${addStyleAttrs(node.attrs.style)} class ="${child.classname}">${next([child])}</p>`;
19+ // },
1320 [ NodeType . LINK ] :( node : Node , next : Next ) => {
1421 if ( node . attrs . target ) {
1522 return `<a${ addStyleAttrs ( node . attrs . style ) } href="${ node . attrs . href || node . attrs . url } " target="${ node . attrs . target } ">${ next ( node . children ) } </a>`
@@ -90,7 +97,11 @@ export const defaultNodeOption: RenderOption = {
9097 return next ( node . children )
9198 } ,
9299
93- [ MarkType . BOLD ] :( text : string ) => {
100+ [ MarkType . BOLD ] :( text : string , classname ?: string ) => {
101+ // if (classname) {
102+ // return `<strong class="${classname}">${text}</strong>`
103+ // }
104+ // else
94105 return `<strong>${ text } </strong>`
95106 } ,
96107 [ MarkType . ITALIC ] :( text : string ) => {
@@ -114,6 +125,9 @@ export const defaultNodeOption: RenderOption = {
114125 [ MarkType . BREAK ] :( text : string ) => {
115126 return `<br />${ text } `
116127 } ,
128+ [ MarkType . CLASSNAME ] :( text : string , classname : string ) => {
129+ return `<span class="${ classname } ">${ text } </span>`
130+ }
117131
118132}
119133
0 commit comments