-
Notifications
You must be signed in to change notification settings - Fork 15
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
markdownify
returns stale unamended markdown library instance
#696
Comments
Thanks @cbutcosk. Can you elaborate a bit on your use of |
On Exhibiting O'Keeffe we modify the markdown library to allow content editors to pass data attributes on link markup to front-end components. Editors insert a These are then harvested by walking across all content and plucking the attributed elements out of the rendered stream, using We had been using
|
@cbutcosk Wondering if you can provide some code for the customization you were using. I ran an extremely simple test and the
I'm currently working through an issue with rendering markdown footnotes inside shortcodes that's giving me a headache, and thinking through the whole template parsing flow. Replacing rid of the |
@hbalenda The
Not sure if we needed both or if the latter always would have caused it. Anyway 11ty's internal handling of amendments is pretty naive--amendments are closures, so they just iterate and execute the stack of closures on the render lib before returning it. So we did the same thing in eleventyConfig.addFilter('markdownify', (content) => {
if (!content) return ''
for (let amendment of eleventyConfig.libraryAmendments['md'] || []) {
amendment(markdownLibrary)
}
return !content.match(/\n/)
? markdownLibrary.renderInline(content)
: markdownLibrary.render(content)
}) Hope that helps in whatever way with your citation issue? It definitely sounds like ETA: Adding the code to call renderTemplate since there's some ceremony to getting it on the // Use `renderTemplate` (see https://www.11ty.dev/docs/plugins/render/#rendertemplate) to render shortcodes (in our case for figures), then HTML
let html = await eleventyConfig.javascriptFunctions.renderTemplate(post.template.frontMatter?.content,'liquid,md' ) |
Before proceeding, check to make sure there isn’t an existing issue for this bug.
Steps to reproduce
markdownify
to render markdown that uses the amended featureActual behavior
The rendered HTML does not include markdown renderer amendments.
Expected behavior
The rendered HTML should included markdown renderer amendments.
Version numbers
1.0.0-rc3
What browsers are you seeing the problem on?
No response
Relevant Terminal/Shell output
No response
Supporting Information
We worked around this by iterating the libraryAmendments array before the markdownlibrary instance is returned in
markdownify
, but 11ty has also lessened the need for a markdown rendering filter now that they released the renderTemplate API.The text was updated successfully, but these errors were encountered: