Closed rowanc1 closed 4 years ago
This does indeed sound like it should be configurable. Would adding a property for this to the token description properties work? If so, a PR for that would definitely be welcome. (You could make it backwards-compatible by making the property default to true for known single-token entities like code block and inline code.)
Oh, yeah adding a property to the token descriptor is much better.
Thoughts on the name of that option:
code_block: {block: "code_block", noOpenClose: true},
Will put a PR together now.
I'd prefer noCloseToken
for the property name.
I have updated the PR with the change, and added docs for this feature.
Thanks for your help on this!
See #44
Released as prosemirror-markdown 1.5.0
🚀
When extending this library with other
markdown-it
extensions, I am having to extend the functionnoOpenClose(type)
here: https://github.com/ProseMirror/prosemirror-markdown/blob/master/src/from_markdown.js#L94For example, in markdown-it-texmath the following blocks are needed:
type == 'math_inline' || type == 'math_inline_double' || type == 'math_block' || type == 'math_block_eqno'
I was wondering if it is worth passing an
options
intoMarkdownParser
that then goes totokenHandlers
, so that this can be done without forking the library?Let me know if this would be wanted and I can put together a PR.