-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No the star is meant to mean any type in the Tokens
namespace. Like Tokens.Code
etc.
|
||
/** | ||
* Renderer | ||
*/ | ||
export class _Renderer { | ||
options: MarkedOptions; | ||
parser!: _Parser; // set by the parser |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we set this in the constructor instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
Marked version: v12.0.2
Description
parser
as a property on the Renderer objectheader
andalign
properties to TableCell tokenContributor
Committer
In most cases, this should be a different person than the contributor.