Simon-He95/vue-markdown-renderer

使用parseMarkdownToStructure给table添加class未渲染

Opened this issue · 0 comments

Describe the bug

具体代码如下
看token是添加了 但是内置了 w-full my-8 text-sm text-left table-fixed table-node 这些样式 并未添加我的class 希望能添加自定义的属性 这样方便修改markdown的样式

function preTransformTokens(tokens: any) {
  tokens.forEach((token:any)=>{
    if(token.type === 'table_open'){
      console.log('table_open')
      if(token.attrPush){
        token.attrPush(['class', 'custom-table']);
      }
    }
  })
  return tokens
}
function handleParseMarkdownToStructure(markdown:string){
 const md=  getMarkdown()
 return  parseMarkdownToStructure(markdown,md,{
    preTransformTokens
  })
}

Reproduction

Used Package Manager

npm

Logs

No response