Skip to content

How to wrap a div element on a table. #3571

Answered by UziTech
YanceyOfficial asked this question in Q&A
Discussion options

You must be logged in to vote

You can use the original renderer to render the table.

import { Marked, Renderer } from 'marked';

const renderer = new Renderer();

const marked = new Marked({
  renderer: {
    table(...arguments) {
      return `<div>${renderer.table.apply(this, arguments)}</div>`;
    },
  },
});

console.log(marked.parse(`
| a | b |
| - | - |
| c | d |
`));

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@YanceyOfficial
Comment options

Answer selected by YanceyOfficial
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants