dillionmegida / gatsby-remark-liquid-tags

📍 A template plugin used for custom embeds in markdowns.
MIT License
10 stars 5 forks source link

replace full paragraph? #5

Closed muescha closed 4 years ago

muescha commented 4 years ago

if i review the code:

https://github.com/dillionmegida/gatsby-remark-liquid-tags/blob/f1c4b5fa4d7217a670298f7a73209bb013354a11/src/index.js#L23

should this not be: /^{\%.*\%}$/g because you replace the full paragraph and not just the value between {% and %}?

https://github.com/dillionmegida/gatsby-remark-liquid-tags/blob/f1c4b5fa4d7217a670298f7a73209bb013354a11/src/index.js#L60-L62

muescha commented 4 years ago

ok - my mistake: with text.replace(exp, embed) you replace the text between the {% and %}

drawbacks if the liquid tags are in the middle of text:

dillionmegida commented 4 years ago

If the liquid tags are in the middle of the text, the expected results may not be achieved.

I thought I stated it in the README that liquid tags must have a line space up and down, but I just checked to discover I didn't. I'll fix that now

This way, the plugin can effectively capture the paragraph with the liquid tags.

dillionmegida commented 4 years ago

Note that the liquid tags must have a line space above and below. This helps the plugin capture the tags correctly. Here's what I mean:

Here it is on the README.md

Thanks for pointing this out