Closed tbrooke closed 3 years ago
Thanks for the request! Yes, this is actually the next thing I am trying to tackle - generic templating in general. I've wanted support for "shortcode" like syntax, such as that from hugo and the mustache-style templates seem common. I'll keep you posted on my progress.
It wouldn't be too bad to search for {{foo}}
in certain non-blacklisted nodes (not in pre or code, for example) and generate a :markdown/mustache
node with just the plain text and then leave the logic up to you for lowering. The blocks seem tricky though.
Alright - so I'm basically done with this feature - but it clashes with the attribute nodes of flexmark. I think I'm more interested in feature-parity between clj and cljs and there isn't a clear path for the exact same attribute behavior in cljs. So, I think I'll prioritize this over attributes and remove them. To be fair, there will be a real commonmark spec for arbitrary metadata in the directives proposal, so I suppose we can just look to implement that instead as it doesn't clash.
Closed via #7 for now - this templating system will get better.
Thanks for looking at this
This is a feature request rather than a true issue so please feel free to ignore it -- I am using Mustache style markers in my Markdown such as {{name}} to be replaced with Tom - If the {{ }} could be separated out as nodes it would make them easier to process -- I could do this outside of Cybermonday but I was thinking it may not be very difficult and it may be that flexmark already can handle this (I am using Clojure not Clojurescript). I thought I'd ask .
Here is an example from my application (the example has an {{#if }} {{/if }} construct that may not be standard mustache): [:p {} "FOR VALUE RECEIVED, the undersigned, {{maker}}, {{#if individual}}an individual residing{{else}}a company registered{{/if}} at {{makerAddress}} (“Maker”), hereby promises to pay to the order of {{lender}}, a {{legalEntity}}, having offices at {{lenderAddress}}, or its successors and permitted assigns (“Lender” or the “Company”), the principal sum of {{principal as \"0,0.00 CCC\"}}, plus any and all interest accrued thereon at the Note Rate (defined below), each due and payable in cash in lawful money of the United States on the dates and in the manner set forth in this Promissory Note (this “Note”)."]