Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.x]: Markdown extra incorrect Special Attributes behaviour #13537

Closed
pixelmachine opened this issue Aug 9, 2023 · 4 comments
Closed

[4.x]: Markdown extra incorrect Special Attributes behaviour #13537

pixelmachine opened this issue Aug 9, 2023 · 4 comments

Comments

@pixelmachine
Copy link

pixelmachine commented Aug 9, 2023

What happened?

I have a plain text field which uses Markdown Extra e.g. {{ copy | markdown('extra', false) }} which works fine except Markdown Extra's "Special Attributes" fail for certain formatting.

This works:
[Google](http://www.google.com){attr=value}
Output:
<p><a href="http://www.google.com" attr="value">Google</a></p>

As do classes and IDs like this {.class #id}.

This does NOT work:
[Google](http://www.google.com){target=_blank}
Output:
<p><a href="http://www.google.com">Google</a>{target=_blank}</p>

Expected behavior

According to the Dingus on the Markdown Extra site, this formatting should be valid.

Dingus output:
<p><a href="http://www.google.com" target="_blank">Google</a></p>

Presumably the _ is causing the failure.

Craft CMS version

Craft CMS 4.3.6.1

PHP version

8.1.17

@brandonkelly
Copy link
Member

That should be reported over at https://github.com/cebe/markdown (the library that’s currently used for Markdown parsing in Craft). However it’s mostly abandoned, so we’re planning to switch to league/commonmark in Craft 5.

@pixelmachine
Copy link
Author

@brandonkelly as I said the formatting does work using PHP Markdown Extra and that can be tested via the link. It only doesn't work in Craft's implementation.

Commonmark doesn't support this syntax sadly.

@pixelmachine
Copy link
Author

pixelmachine commented Aug 10, 2023

Ah wait, I see what you're saying, I didn't spot that was a multi-markdown library. It's libraries all the way down. I assumed you were just using PHP Markdown Extra.

I can confirm that it doesn't work using cebe/markdown and in fact they say that Markdown Extra is not fully supported. Perhaps worth mentioning in the docs?

@brandonkelly
Copy link
Member

@pixelmachine Ah good catch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants