ayushn21 / bridgetown-svg-inliner

Liquid and ERB helper for Bridgetown to inline SVG files in HTML
MIT License
9 stars 2 forks source link

Bridgetownrb returns an error when using {% svg "path" %} in a code piece #1

Closed JuanVqz closed 3 years ago

JuanVqz commented 3 years ago

As I said in my blog I wanted to show off how to install and use this gem in Bridgetown

when I was writing in a markdown file and put the following lines as code blocks, the compiler just breaks down.

<!-- Liquid -->
{% svg "/assets/icons/thumbs-up.svg" %}
<!-- ERB -->
<%= svg "/assets/icons/thumbs-up.svg" %>

in order to solve the problem, I put a # to scape the code.

<!-- Liquid -->
{#% svg "/assets/icons/thumbs-up.svg" %}
<!-- ERB -->
<#%= svg "/assets/icons/thumbs-up.svg" %>

reference article

ayushn21 commented 3 years ago

Thanks for flagging this @JuanVqz. Not sure why this is happening but will investigate as soon as I can!

ayushn21 commented 3 years ago

Hey @JuanVqz, I've tested this on Bridgetown 0.21.2 using Ruby 2.7.3 and 3.0.2 and been unable to reproduce the issue. The site is built without errors and renders as expected. Could you please post a test repo for me where I can reproduce and diagnose the error? Thanks :)

JuanVqz commented 3 years ago

sure! I'll do it this afternoon. I ran bridgwtown --version and returns v0.21.3 "Broughton Beach" using ruby 3.0.0

JuanVqz commented 3 years ago

@ayushn21 when I got the error I just put both liquid and erb formats in the markdown file, so I didn't double check which one was the cause of the error I saw.

I tested it again and nothing failed now the {% svg "images/github.svg" %} is converted to a svg.

here is the commit

this is the repo and this is the post where you can see it as SVG tag instead of a liquid tag.

erb format is working as expected

svg_liquid

ayushn21 commented 3 years ago

Thanks @JuanVqz for the example repo. I'm not sure exactly what you're trying to accomplish but I hope the following answers your questions.

Hope this helps!

JuanVqz commented 3 years ago

you are right I wanted to escape the liquid tags. thank you for your time