When i write some tag inside of the if statement, the tag is render like text and not like html tag, how can i solve this?

indeed that’s user supplied text in the .Inner of the Shortcode - but if that’s the use case the purpose of the shortcode. usage of safeHTML there states he trusts.

p.s. there’s no hardcoded slice inside … but variable text in the shortcode

{{< article> >}}
this is article one
<-->
this is article two
{{< /article >}

— and rethinking

I doubt our OP really wants to have real HTML within the .Inner of the Shortcode but maybe Markdown, so I would change the stuff to:

  • markdown
# My Articles

{{< article >}}

## Article One

and a paragraph

<-->

## Article Two

-  some
-  list
-  items

{{< /article >}}

  • article.html
{{ range $index,$content := split .InnerDeindent "<--->" }}
   {{ if lt $index 2 }}
      <article class="{{ if eq $index 0 }}first-text{{ else }}second-text{{ end }}">
         {{ $content | $.Page.RenderString }}
      </article>
   {{ end }}
{{ end }}