gettalong / kramdown

kramdown is a fast, pure Ruby Markdown superset converter, using a strict syntax definition and supporting several common extensions.
http://kramdown.gettalong.org
Other
1.72k stars 274 forks source link

Attribute name consisting of colon does not get parsed #784

Closed vietqhoang closed 1 year ago

vietqhoang commented 1 year ago

Example of issue

Take the following example using an IAL:

[A link](https://www.github.com){: namespace:something="value" }

It'll render the following:

<a href="https://www.github.com">A link</a>

I was expecting the following:

<a href="https://www.github.com" namespace:something="value">A link</a>

Real use case

I ran into this issue when I was working on some Markdown files that are used for my app's mailers via a dependency called maildown, which uses Kramdown as the Markdown engine.

In our mailers we sometimes use a Mailchimp/Mandrill disable tracking flag, mc:disable-tracking, which consists of a colon to namespace their attributes.

I was expecting the following Markdown to parse into the resulting HTML.

[A link](https://www.github.com){: mc:disable-tracking="" }
<a href="https://www.github.com" mc:disable-tracking="">A link</a>

Just the verify that IAL is working on my system, the following worked as expected.

[A link](https://www.github.com){: mcdisable-tracking="" }
<a href="https://www.github.com" mcdisable-tracking="">A link</a>

Things I tried...

I tried surrounding the attribute name with single and double quotes.

I haven't dug into the project source code yet to understand where the issue (if it is one) lies.

gettalong commented 1 year ago

Namespaced attributes are not supported. If you need something like that, please use plain old HTML or provide a pull request for the feature - thanks!