Skip to content
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

Howdy! Here I am with what went wrong #2

Closed
zachleat opened this issue Jun 14, 2022 · 1 comment
Closed

Howdy! Here I am with what went wrong #2

zachleat opened this issue Jun 14, 2022 · 1 comment

Comments

@zachleat
Copy link

So here’s a working copy of the template in question:

    {% renderTemplate "md" %}
# I expect this to output an h1 and 2 list items

* I am a list
* I am a list
    {% endrenderTemplate %}

    {% renderTemplate "liquid,md" %}
> I expect this to output the markdown from the shortcode

{% outputMD %}
    {% endrenderTemplate %}

A few things, you got bit by the dreaded indented code blocks feature of Markdown https://www.11ty.dev/docs/languages/markdown/#there-are-extra-and-in-my-output

This prompted me to file 11ty/eleventy#2438 and I’m ready to get rid of that feature by default :D

I wonder if we should do something fancier with deindent on render templates? I’m not sure.

The other thing is that {% renderTemplate "md" %} doesn’t use the liquid/njk preprocessors by default, so you need to opt-in to that like this {% renderTemplate "liquid,md" %}

@brob
Copy link
Owner

brob commented Jun 14, 2022

Aha! I've hit this before in other contexts, but completely forgot about it in this context!

Thanks for coming back around to this! I was thinking about the Render plugin for an upcoming video. may hit a couple more basics first, though

Something fancier may not be worth the effort, but deprecating indented code blocks in markdown sounds great 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants