# Parsing shortcodes as liquid tags/includes

**URL:** <https://talk.jekyllrb.com/t/parsing-shortcodes-as-liquid-tags-includes/8171>\
**Category:** Help\
**Created:** [April 19, 2023, 10:05am UTC](https://talk.jekyllrb.com/t/parsing-shortcodes-as-liquid-tags-includes/8171 "2023-04-19T10:05:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Koos](https://avatars.discourse-cdn.com/v4/letter/k/2acd7d/32.png) [@Koos](https://talk.jekyllrb.com/u/Koos)\
**Post date:** [April 19, 2023, 10:05am UTC](https://talk.jekyllrb.com/t/parsing-shortcodes-as-liquid-tags-includes/8171/1 "2023-04-19T10:05:52Z")

</div>

I’m trying to let Jekyll interpret something like this:

```md
<!--< include myInclude.liquid property = value >-->

```

as

```plaintext
{% include myInclude.liquid property = value %}

```

I’ve tried simple text replacement like this:

```plaintext
{{ content | replace: '<!--<', '{%' | replace: '>-->', '%}' }}

```

But either the curly trip up Jekyll because of a syntax error, or I escape the strings and they’re actually escaped and the liquid tags are never parsed as liquid.

Am I trying to do the impossible, or is there a some other way I haven’t thought about yet?

Background for why I even want this: I’m migrating our site from Forestry to Tina CMS, which is supposed to be Forestry V2. Many of our markdown files contain Jekyll includes. Tina messes these up, adding `\` to escape curly braces and underscores. Now that’s obviously an issue that should be fixed in the Tina project, but for now I need a quick solution to circumvent it.

---

<div class="post-metadata">

**Author:** ![chuckhoupt](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/chuckhoupt/32/523_2.png) [@chuckhoupt](https://talk.jekyllrb.com/u/chuckhoupt)\
**Post date:** [April 19, 2023, 11:47am UTC](https://talk.jekyllrb.com/t/parsing-shortcodes-as-liquid-tags-includes/8171/2 "2023-04-19T11:47:29Z")

</div>

> [@Koos](#):
>
> I’ve tried simple text replacement like this:
> 
> ```plaintext
> {{ content | replace: '<!--<', '{%' | replace: '>-->', '%}' }}
> 
> ```
> 
> But either the curly trip up Jekyll because of a syntax error, or I escape the strings and they’re actually escaped and the liquid tags are never parsed as liquid.

I think the issue with this approach is that Liquid is only evaluated in one pass (AFAIK), so the output of the text replacements won’t get evaluated a second time by Liquid (even if it is syntactically correct Liquid).

Possibly a custom Jekyll plugin could do the transform? But I’m not sure…

---

<div class="post-metadata">

**Author:** ![Koos](https://avatars.discourse-cdn.com/v4/letter/k/2acd7d/32.png) [@Koos](https://talk.jekyllrb.com/u/Koos)\
**Post date:** [April 19, 2023, 1:23pm UTC](https://talk.jekyllrb.com/t/parsing-shortcodes-as-liquid-tags-includes/8171/3 "2023-04-19T13:23:13Z")

</div>

Okay thanks, now I know this approach won’t get me any further!

---

<div class="post-metadata">

**Author:** ![chuckhoupt](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/chuckhoupt/32/523_2.png) [@chuckhoupt](https://talk.jekyllrb.com/u/chuckhoupt)\
**Post date:** [April 19, 2023, 2:08pm UTC](https://talk.jekyllrb.com/t/parsing-shortcodes-as-liquid-tags-includes/8171/4 "2023-04-19T14:08:30Z")

</div>

I gather the issue is that Tina CMS allows you to edit Markdown, but it doesn’t support Jekyll’s Markdown+Liquid format? So any Liquid code is escaped.

Another option might be to try and de-escape the Markdown before running `jekyll build`. For example, a shell/python/ruby/etc script could be run over the sites source code to reverse the escaping applied by Tina.

---

<div class="post-metadata">

**Author:** ![Koos](https://avatars.discourse-cdn.com/v4/letter/k/2acd7d/32.png) [@Koos](https://talk.jekyllrb.com/u/Koos)\
**Post date:** [April 19, 2023, 3:07pm UTC](https://talk.jekyllrb.com/t/parsing-shortcodes-as-liquid-tags-includes/8171/5 "2023-04-19T15:07:49Z")

</div>

Mm yeah I hadn’t thought of that! It feels a bit brittle though. Anyway, I’m few steps further and found out that if I don’t have any underscores in the parameters, the only thing I need to do is removing a superfluous snippet name that’s inserted by Tina. IMO the issues are actually unintended and I hope they’ll be fixed soon.

---

<div class="post-metadata">

**Author:** ![Koos](https://avatars.discourse-cdn.com/v4/letter/k/2acd7d/32.png) [@Koos](https://talk.jekyllrb.com/u/Koos)\
**Post date:** [April 21, 2023, 10:59am UTC](https://talk.jekyllrb.com/t/parsing-shortcodes-as-liquid-tags-includes/8171/6 "2023-04-21T10:59:02Z")

</div>

If anyone else has this issue: you need to add a `name` field to the property’s `match` object. That name, which is different from the property’s name, can contain special characters. This behavior may change, so [here’s the Github issue](https://github.com/tinacms/tinacms/issues/3824#issuecomment-1517599185) for reference.
