textile/php-textile

Custom attributes to any element

Opened this issue · 1 comments

The ability to add any attribute to any tag would be a very welcome addition.

Accessibility and custom attributes for things like JS triggers are road blocks I run into all the time with Textile. I find that I need to add aria- and data- attributes to specific tags and I end up having to disable Textile or write large blocks of inline HTML.

It'd be nice if there was a way to do something like:

p(some-class another-class #some-id [data-toggle=collapse]). Lorem %([aria-label=some accessible label][role=presentation])ipsum% dolor sit amet, consectetur adipiscing elit.

And get:

<p class="some-class another-class" id="some-id" data-toggle="collapse">
  Lorem <span aria-label="some accessible label" role="presentation">ipsum</span> dolor sit amet, consectetur adipiscing elit.
</p>
gocom commented

With versions => 3.7.0, HTML can be mixed quite well without escaping, so that at least helps.

But indeed, being able to use and handle any type of attribute would be nice. It could even be beneficial in the future if we ever modernize the parser and make it possible to generate other document formats than just HTML.