Expose data cascade in transforms #4045
Replies: 4 comments
|
Are you using markdown-it-abbr? I'd guess that
Maybe you could use an intermediate Another idea: you could consider transforming final HTML files via DOM manipulation. Andy Bell does this in Hylia. js-dom reads Eleventy's final HTML and converts And if you disable the DOM transformer at some point in the future, you'll just end up with plain old HTML from markdown, as opposed to some broken looking WP style shortcode like |
|
Hey @jevets,
No, I haven't heard of it before.
That wouldn't help me much (but perhaps in the beginning). Think of cases, where an abbreviation could have different meanings. Say, „IP” as „Internet Protocol” or „Intellectual Property”. That's why I thought putting it in the Frontmatter ;-)
Hm … I have used JS-DOM only for testing. Interesting idea to use it in post-processing! You've provided me with some more aspects to think over. Thanks for this! |
|
I don’t think we would want to limit this to front matter specifically but rather just the entire data cascade result would be easier to implement.
|
Uh oh!
There was an error while loading. Please reload this page.
Right now, I'm adding
<abbr>tags in abbreviations I use in my markdown files manually.This morning it struck me, that it would be neat if Eleventy would have access to the frontmatter in the transform function (or at the point in a content lifecycle, where it gets injected into a template).
Describe the solution you'd like
This way I could declare a key value pair in the frontmatter of an abbreviation to its extended from.
Another use case could be to apply microformats2 to certain element (e.g. a checkin) where I only declare a phrase (e.g. „Checked in to
<X>”) and have a transform which applies the markup for it.Describe alternatives you've considered
Right now, I'm adding the markup directly.
Alternatively I could declare some partials and somehow use them (e.g. as shortcode).
But I have bad experiences with that from my WordPress time (template „broken” once the plugin is removed without a reliable way to spot the affected sites).
Additional context
As mentioned, it is a quick idea of mine.
Feedback welcome :-)
All reactions