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

Markdown outcome parsed as pre/code tags #533

Closed
jeremenichelli opened this issue May 17, 2019 · 4 comments

Comments

Projects
None yet
3 participants
@jeremenichelli
Copy link

commented May 17, 2019

For some reason indentation in liquid templates makes part of them rendered as code, here's a resduced example:

This in Jekyll gets rendered correctly, but in Eleventy content inside if/else statements get rendered inside <pre><code></code></pre> tags:

<a
      class="archive__link"
      alt="{{ post.title }}"
      {% if post.external_url %}href="{{ post.external_url }}" target="_blank"
      {% else %}href="{{ post.url }}"
      {% endif %}
  >
  {{ post.title }}
</a>

To fix this I needed to flatten all indentation:

<a class="archivelist__link" alt="{{ post.data.title }}"
{% if post.data.external_url %}href="{{ post.data.external_url }}" target="_blank" rel="noopener noreferrer"
{% else %}href="{{ post.url }}"
{% endif %}>

I'm thinking this could be a limitation of JavaScript implementation of Liquid, or the markdown parser, sorry for the noise if that's the case. And let me know if I can help further on this 😃

@edwardhorsford

This comment has been minimized.

Copy link
Contributor

commented May 17, 2019

I suspect this is the same as #219 where markdown is interpreting the whitespace as code. Try using {%- foo -%} instead. More docs here.

@jeremenichelli

This comment has been minimized.

Copy link
Author

commented May 17, 2019

Oh, got it! Thanks a lot @edwardhorsford 💯

@Ryuno-Ki

This comment has been minimized.

Copy link
Contributor

commented May 17, 2019

4 spaces are interpreted as beginning of a code block.

@jeremenichelli

This comment has been minimized.

Copy link
Author

commented May 19, 2019

@Ryuno-Ki yeah looks like it, don't know if that's common in markdown parsers though, didn't have this output with the same snippet in Jekyll + kramdown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.