feat: support rendering from pre-processed tokens - #53
Conversation
|
This would also allow users to use different markdown parsers, at least in theory, supposing the tokens are in the same format, or can be coerced to be. Possibly even parsers for different markup languages (I'm contemplating creating a small language with peggy and rendering its tokens using svelte-markdown, if this feature is added). |
|
This actually looks great! Allows for extra flexibility without compromising on bundle size (or the original API)! Could you also update the types on |
|
I gave it a shot but I'm not very familiar with typescript. You should double check that. |
|
Added documentation of the feature to the readme, too. |
pablo-abc
left a comment
There was a problem hiding this comment.
This is perfect! Thanks a lot!
|
No problem! Glad to help. |
Adds support for passing an array of tokens as the
sourceoption. This allows the user to generate and transform tokens freely before rendering. It also obviates the need forwalkTokenssupport (#39). Users needing this feature can lex the tokens themselves.Any array given as
sourceis assumed to be an array of tokens. If the source is not an array it is assumed to be a string and is treated normally.A simple test is included.