ProseMirror / prosemirror-markdown

ProseMirror Markdown integration
https://prosemirror.net
MIT License
344 stars 81 forks source link

Support passing in markdown-it `env` #86

Closed segevfiner closed 2 years ago

segevfiner commented 2 years ago

markdown-it can receive an env object in its parse call that can be used to retrieve and pass in some information into the parser for some plugins and token types. It would be nice to be able to pass it in.

marijnh commented 2 years ago

What kind of thing is this used for? Would you want to pass it in to the parse method, or the MarkdownParser constructor?

segevfiner commented 2 years ago

To the parse method.

See https://markdown-it.github.io/markdown-it/#MarkdownIt.parse & https://github.com/markdown-it/markdown-it/blob/master/docs/architecture.md#data-flow

marijnh commented 2 years ago

I know what that argument is, what I was asking is what you are using it for.

segevfiner commented 2 years ago

To pass and receive environmental data from some custom markdown-it plugin.

marijnh commented 2 years ago

Added in attached patch.