-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
Allow configurability of the xexprs generated by the Markdown parse #50
Comments
Thanks for the FR. I feel bad I've left #48 open all this time. Although I need to reload my brain with that discussion, IIRC yes I think it would address what you want to do. I think that's probably a better way to do this, because I'm wary of accumulating more options (and the accompanying test matrices and bugs). The mission of this package is to cope with the ambiguous markdown "spec" and produce a coherent, usable xexpr. That's turned out to be remarkably difficult, at least 10x more than I imagined when I started. That's why I feel like tweaking the xexpr should be done post-parse, or, via some general user-supplied tweaker function -- because either way, it's something I'm not responsible for testing and fixing. :) p.s. Although the |
Hmm yes: so a way of addressing this FR which appears compatible in style with the #48 possible-solution (as I understand it) might be:
That would require the That would mean that the only thing you'd need to test would be the default case. I entirely understand your desire to keep the parser focused. One can imagine a more general interpretation-tweaker function which gets the element content as well, but that's getting over-fancy – if I want to do that, I think I should be obliged to do it in my own time (as it were), in a post-parse walk. Just to be clear, I think this FR is a 'nice to have' feature, but nothing stronger. |
Specific case first:
The Markdown library currently generates
(h1 () ...)
for Markdown====
headers, and(h2 () ...)
for----
headers. For my application I'd prefer these to be(h2 () ...)
and(h3 () ...)
respectively. That's easy to fix, since I can just walk the tree adjusting them post-parse. However it would be neater if I could ask the parser to do that for me.I see that this overlaps with the discussion of tree-walking, and its costs, in pull request #48, so might relate to that.
Looking at
$setext-heading/para/plain
inparse.rkt
, I see that thish1
/h2
interpretation is implemented by a(match ...)
expression, so that looks like a natural location for a parameter, but you'll have a better idea than me of how expensive that would be.There's a potential more general point, in that there are other places where it looks natural for a user to impose a different interpretation on the parse – functions
$_emph
and$_strong
– but those cases are more marginal, and it might be that the sort of configurability I'm suggesting above is not worth generalising.The text was updated successfully, but these errors were encountered: