How to make Jekyll process angle brackets in attributes correctly?

This is probably a really niche problem, but in the template syntax of Vue and Alpine things like this are useful:

<button x-on:click="(if (foo>0) doSomething()">Label</button>

Jekyll turns the above into this, which Alpine parses as intended:

<button x-on:click="if (foo&gt;0) doSomething()">Label</button>

Vue and Alpine also allow this type of shorthand:

<button @click="if (foo>0) doSomething()">Label</button>

Unfortunately, Jekyll doesn’t like that and makes this out of that:

<button>0) doSomething()"&gt;Label</button>

I could write this instead:

<button x-on:click="if (foo&gt;0) doSomething()">Label</button>

But I find that makes the code hard to read.

I guess I have to choose between using > in my statements and shorthand. But I wonder if there’s a way around that?

I just created a new Jekyll site (4.2.1), created a new HTML file, and populated it with your code samples as you can see in the screenshot below:

When I run Jekyll, the labels output properly in HTML and the output looks like I would expect (no changes) as you can see in the screenshot below:

I am wondering now if Jekyll is really doing this conversion, if you are not sharing enough code to understand the problem, or perhaps it has to do with I am running a newer version of Jekyll? Or is it that I am missing something really simple, which could be the case? :slight_smile:

Could you give more details about the context. I’m guessing you’re writing Markdown with inline-HTML?

Thanks so much for checking! I’d spend so much time narrowing the error down to my Jekyll setup that I forgot to check if it perhaps was indeed my setup and not Jekyll itself. Turns out that most likely the ext-links filter plugin is to blame!

Ah! Okay glad you figured it out!