Add engine specific delimiters #75
Loading…
Reference in a new issue
No description provided.
Delete branch "colinbate/per-lang-delims"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR does make some changes to the nature of
matter.language(), which probably isn't desired. I can remove that and make another method for this if necessary, but I thought I'd get a working version out there for review.Files parsed with custom delimiters should round-trip via stringify correctly.
This is a great start! Nice work.
I'm thinking we should allow users to decide how they want to specify the engine to use:
The main goals are performance and reliability, as long as it satisfies those two things I'm open to whatever approach you want to take. Although I'd probably favor options versus additional methods.
Previously, if you specified the language after the fence in the front matter, it would override the language passed into the options. With this change, any recognized custom delimiter will also override the passed in language. After thinking about it seems okay, it is the document which gets to specify the language, and the options are just providing the fallback language. So on that front, all is fine.
The issue with
matter.language()is that it now requires the full file contents as its first parameter. Previously it would work with a string which had the initial---fence trimmed off. Also, the object it returns has an additional property, but that isn't a big deal. What is different about the return value is that therawproperty now includes the whole fence:---coffeevs. justcoffeeas before. Let me know if this is a concern; I could make the changes fully backward compatible if necessary.As for performance, the cases where there is front matter with a default delimiter should be unchanged. The only situation which would be affected is if you have a string or file without any front matter, and you have many engines defined.
I've pushed a small tweak to ensure you don't register a custom engine delimiter the same as the default one.
I didn't regenerate the README file, but I did update the underlying verb file. I wasn't sure if you normally do that. The output differed in a couple of ways, so I didn't want to presume.
@jonschlinkert Just checking in to see if you've had a chance to look at this further. I think it is mergeable, just let me know if you want me to regenerate the README or any other housekeeping.
Just revisiting this as I’ve come across another place where I’d like the per-engine delimiters.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.