Konafets / antlers-idea

Adds support for Antlers, the templating language of Statamic

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Line breaks not handled gracefully

hotmeteor opened this issue · comments

Great plugin, thanks for the work on it!

One UX issue I often hit is the way the Antlers tags are formatted. The biggest issues I hit are:

  • Subsequent tags ignore the line breaks I add, so they all run together
  • Long tags get line-breaks in the middle of them, and then the next tags follow right after

I've included some code below so you can get a sense of what I mean.

{{ nocache }} {{ collection from="training_log" status:is="published" limit="20"
    sort="date:desc" }}
<div class="flex {{ index === 0 ? 'col-span-3 row-span-3 sm:col-span-2 sm:row-span-2' : '' }}">
  <a class="group relative flex" href="{{ url }}">
    {{ if images }} {{ images limit="1" }} <img class="object-cover relative z-0" src="{{
    imagekit :src=" path" n="home_thumbnail" }}" alt=""/> {{ /images }} {{ /if }} {{ if
    index===0 }}
    <div
      class="pointer-events-none absolute bottom-0 right-0 z-20 bg-black bg-opacity-75 px-4 py-2 text-xs font-semibold text-cfhsv-blue group-hover:text-cfhsv-light-blue"
    >
      {{ title }}
    </div>
    {{ /if }}

    <div
      class="pointer-events-none absolute inset-0 z-10 bg-black opacity-20 transition-all duration-200 group-hover:opacity-0"
    ></div>
  </a>
</div>
{{ /collection }} {{ /nocache }}

This obviously isn't a breaking issue but visually it makes it tough to ensure my tags are configured and balanced correctly.

Thanks!

Hi @hotmeteor,

I found out that the plugin gets confused by the dynamic binding. When you remove the colon from the params and reformat the file, it works as expected.

Dynamic binding is only available for Tags and as for now the plugin operates on a defined set of Tags provided by Statamic and doesn't know Tags coming from Addons like in this case. I need to find a way to make the internal list of Tags dynamic taking all Tags in a project into account.

Thanks for bringing this issue up :-)

Hi @hotmeteor,

can you provide an example of how the above snippet should be formatted in your opinion?

Thanks in advance!