Closed alsoicode closed 1 week ago
Marked version:
13.0.1
Describe the bug
When providing a custom renderer to override the table output, the token value passed to the function does not contain header or rows data.
token
header
rows
To Reproduce Steps to reproduce the behavior:
Add a custom renderer:
const renderer = { table(token: Tokens.Table): string { return ` <table class="table table-striped"> <thead>${ token.header }</thead> <tbody>${ token.rows }</tbody> </table> `; } }; marked.use({ renderer });
When provided with sample data:
| Key | Value |\n| ---- | ----- |\n| A | 1 |\n| B | 2 |\n| C | 3 |
The value of token is:
<tr> <th>Key</th> <th>Value</th> </tr>
No other properties on the token object are populated and the value is a string, not an object.
Expected behavior
A token object would have been returned, not a string.
See https://marked.js.org/using_pro#renderer
You have to use marked.use({ useNewRenderer: true, renderer }); for v13 to use new token renderers.
marked.use({ useNewRenderer: true, renderer });
Marked version:
13.0.1
Describe the bug
When providing a custom renderer to override the table output, the
token
value passed to the function does not containheader
orrows
data.To Reproduce Steps to reproduce the behavior:
Add a custom renderer:
When provided with sample data:
The value of
token
is:No other properties on the token object are populated and the value is a string, not an object.
Expected behavior
A
token
object would have been returned, not a string.