feat: Send token objects to renderers - #3291
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
| align: 'center' || 'left' || 'right' | ||
| } | ||
| ``` | ||
| The Tokens.* properties can be found [here](https://github.com/markedjs/marked/blob/master/src/Tokens.ts). |
There was a problem hiding this comment.
| The Tokens.* properties can be found [here](https://github.com/markedjs/marked/blob/master/src/Tokens.ts). | |
| The *Tokens.* properties can be found [here](https://github.com/markedjs/marked/blob/master/src/Tokens.ts). |
Is this missing an asterisk to make it italic?
There was a problem hiding this comment.
No the star is meant to mean any type in the Tokens namespace. Like Tokens.Code etc.
| */ | ||
| export class _Renderer { | ||
| options: MarkedOptions; | ||
| parser!: _Parser; // set by the parser |
There was a problem hiding this comment.
Can we set this in the constructor instead?
There was a problem hiding this comment.
No because the Renderer is instantiated before the Parser any time a renderer extension is used. The tokenizer has the same problem with the lexer being set this way.
This problem mostly exists since the Lexer and Parser can be used in a static way marked.lexer(options)
Maybe we can require instance in the future
There was a problem hiding this comment.
Maybe we can require instance in the future
That sounds good to me 👍
|
There seems to be a problem with the docs for this change since we use the current marked but a version of marked-highlight that does not support this new renderer parameters. I think I am going to have to find a way for both to be available for this to work so we can transition extensions. |
|
I created a temporary option This temporary option will be removed in a future major version which will break renderer extensions that have not updated to accepting an object. |
# [13.0.0](markedjs/marked@v12.0.2...v13.0.0) (2024-06-12) ### Bug Fixes * blockquote code continuation ([#3264](markedjs/marked#3264)) ([05749a6](markedjs/marked@05749a6)) ### Features * Send token objects to renderers ([#3291](markedjs/marked#3291)) ([6533726](markedjs/marked@6533726)) ### BREAKING CHANGES * extensions that change marked renderers will need to be updated and use new option `useNewRenderer` * add space token after blockquote and hr if there are multiple newlines
Marked version: v12.0.2
Description
parseras a property on the Renderer objectheaderandalignproperties to TableCell tokenContributor
Committer
In most cases, this should be a different person than the contributor.