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

Allow adding attributes without value #986

Merged
merged 5 commits into from
Jul 31, 2023
Merged

Allow adding attributes without value #986

merged 5 commits into from
Jul 31, 2023

Conversation

svenluijten
Copy link
Contributor

As said in #985, this is my attempt at allowing valueless attributes to be set on elements.

@svenluijten
Copy link
Contributor Author

svenluijten commented Jul 29, 2023

Unfortunately the tests seem to fail as it is, probably because the regex is now too loose, causing a single functional test to fail; one that has to do with illegal whitespace in HTML. I'd appreciate some help to fix that if this is a feature you'd want included 🙂

@colinodell colinodell linked an issue Jul 31, 2023 that may be closed by this pull request
@colinodell
Copy link
Member

Thanks for working on this! I left some pointers on your original proposal which should hopefully help here.

src/Util/RegexHelper.php Outdated Show resolved Hide resolved
src/Extension/Attributes/Util/AttributesHelper.php Outdated Show resolved Hide resolved
@svenluijten
Copy link
Contributor Author

Thanks for the pointers! I'll work them out later today. Meanwhile, do you want me to point this PR to main? Seeing as you added the issue to the 2.5 milestone?

@colinodell
Copy link
Member

colinodell commented Jul 31, 2023

Meanwhile, do you want me to point this PR to main? Seeing as you added #985 to the 2.5 milestone?

Ah, yes please! Edit: looks like I can do that :)

@colinodell colinodell changed the base branch from 2.4 to main July 31, 2023 15:55
Copy link
Member

@colinodell colinodell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@svenluijten
Copy link
Contributor Author

FWIW, this is what I was working on when I thought I could use valueless attributes 🙂

@colinodell colinodell merged commit 2138460 into thephpleague:main Jul 31, 2023
@colinodell colinodell added this to the v2.5 milestone Jul 31, 2023
@colinodell
Copy link
Member

This change will be available in the future 2.5.0 release. It may be a little while before that gets tagged, as I'm hoping to include some additional (unrelated) changes at the same time.

@jasonvarga
Copy link
Contributor

jasonvarga commented Jul 22, 2024

Hello. This PR has unfortunately caused some issues for us.

Apologies for commenting on an old PR, but this has only just been tagged today.

I'm happy to try and open a PR to fix this myself, but I thought I'd mention it here first as you may understand the problem better.

When we have templating language within our markdown string, previously the markdown parser would leave it alone. Now, it basically clears it out. For example:

$converter->convert('# Hello {{ foo }}');

// Before: <h1>Hello {{ foo }}</h1>
// After: <h1>Hello {}</h1>

We use the AttributesExtension. If I revert the SINGLE_ATTRIBUTE const change from this PR, it works again (but obviously your feature wouldn't).

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

Successfully merging this pull request may close these issues.

Allow setting attributes without values in Attributes extension
3 participants