Closed CalebJohn closed 2 years ago
Sorry for the late reply, I was away from my laptop for a while.
The coding style is nice. I think the testing framework can hardly check these open/close tags, and I'd just leave the relevant tests to-dos for now.
It seems state
are overriden in parse
function. This PR does work, but I wonder if it can create a temporary state and call tokenize
function instead, so there's no need to mutate each block token?
It seems
state
are overriden inparse
function. This PR does work, but I wonder if it can create a temporary state and calltokenize
function instead, so there's no need to mutate each block token?
That's a good idea, I'll give it a try. I suspect the tokens might still need to be mutated to get the correct map
.
I'm away from my dev environment for the next 2 weeks, but I'll look into this again in the new year! Thanks.
@redbug312 I've got my dev machine back and this solution based on your suggestion should be a bit cleaner than before. No more mutation, but I did have to add some padding to the text
in order to get the line mapping to work correctly. Let me know what you think!
Thanks for the trying, and the revision looks great! I'd merge the PR as v4.1.2.
When using
state.md.block.parse
it loses all context as to where the tokens are placed within a document. Notably, level and map which represent token nesting level and source line number respectively.This PR stores the created tokens temporarily so that the context can be added back manually before pushing the tokens onto the state. I did my best to follow the projects style, but please let me know if you have any requested changes, I'd be more than happy to change this to how you see fit. I also didn't see how this change could fit into the current testing framework, so there are no tests for now.