Skip to content
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

Pass token to renderer methods ? #2640

Open
kapouer opened this issue Nov 3, 2022 · 4 comments
Open

Pass token to renderer methods ? #2640

kapouer opened this issue Nov 3, 2022 · 4 comments
Labels

Comments

@kapouer
Copy link
Contributor

kapouer commented Nov 3, 2022

Describe the feature
Currently renderer methods get arguments cooked by marked Renderer Parser, as in code(code, infostring, escaped).
On the other hand, extensions rendered methods get a token parameter with all its properties.
I request that all renderer methods get a token.

Why is this feature necessary?
For example this.renderer.list won't know if the list is loose.

Describe alternatives you've considered
I could have asked for this.renderer.list to get a (body, ordered, start, loose) signature.
But passing the token around systematically seems to be much simpler.

@UziTech
Copy link
Member

UziTech commented Nov 3, 2022

I would love this. It would make certain things so much easier. Unfortunately this would be a huge breaking change to most marked renderers. If we could do this in a way that would allow the tokens and deprecate the old way first I would be on board.

@kapouer
Copy link
Contributor Author

kapouer commented Nov 4, 2022

Ideas, in my order of preference:

  1. "opt-in" with a legacyRenderer: true flag
  2. this.renderer.token = token before each call (considering that renderers are sync functions)
  3. add a extensions.renderer catch-all method

@calculuschild
Copy link
Contributor

@UziTech Is this something we can add along with #2805 for the next major version?

@UziTech
Copy link
Member

UziTech commented Jul 3, 2023

Ya this would be nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants