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

Fixes for PHP attribute parsing #175

Merged
merged 1 commit into from
May 27, 2024

Conversation

wouterj
Copy link
Contributor

@wouterj wouterj commented May 21, 2024

@javiereguiluz
Copy link
Collaborator

This is so great! You now even highlight inlined attributes in controller arguments 😍

I've just updated symfony.com to add this: .hljs-php-attribute, .codeblock-php .hljs-meta { ... } and I'll remove .hljs-php-attribute when the docs are rebuilt with this new version. So, everything is ready on that side.

Thanks a lot!

@wouterj wouterj marked this pull request as draft May 21, 2024 21:03
@wouterj
Copy link
Contributor Author

wouterj commented May 21, 2024

Thanks Javier :)
Looking at the tests, this unfortunately this apparently broke other PHP syntax. Needs more investigation.

@wouterj wouterj marked this pull request as ready for review May 25, 2024 11:13
@wouterj
Copy link
Contributor Author

wouterj commented May 25, 2024

This PR is ready to merge now. Fix was to reorder the syntax elements in the parameter list, no clue why but it seems to work (also checked by building the full docs locally).

I've just updated symfony.com to add this: .hljs-php-attribute, .codeblock-php .hljs-meta { ... } and I'll remove .hljs-php-attribute when the docs are rebuilt with this new version. So, everything is ready on that side.

You might want to make it .hljs-meta (so without scoping to only PHP codeblocks). Meta is used for special meta syntax in other formats (e.g. the doctype in HTML/XML, use strict in JavaScript and anchors/references in Yaml).

@javiereguiluz
Copy link
Collaborator

Great! Wouter, thanks again for this super nice contribution. I'm going to merge and tag a new release to use this on symfony.com ASAP.

@javiereguiluz javiereguiluz merged commit 533dd4d into symfony-tools:main May 27, 2024
3 checks passed
@wouterj wouterj deleted the php-attributes-v2 branch May 27, 2024 08:54
@javiereguiluz
Copy link
Collaborator

After deploying and rebuilding the docs, the highlighting of PHP attributes is now perfect. See e.g. the page that was showing the issue before: https://symfony.com/doc/current/reference/constraints/AtLeastOneOf.html#basic-usage

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

Successfully merging this pull request may close these issues.

Minor issue when highlighting some PHP attributes
2 participants