Skip to content

Conversation

@wouterj
Copy link
Contributor

@wouterj wouterj commented Dec 28, 2025

I ran into some issues specifying allowed elements in the sanitizer config. I think the config is broken as-is. So I copy pasted the config from Symfony's FrameworkBundle and made it work with the guides extension instead.
Meanwhile, I also made it a bit nicer for non-XML config (they can now use array keys instead of the name option).

I'm not sure why the Guides extension allows specifying multiple sanitizer configs and then setting one name as the sanitizer to use. What is the use case of these other sanitizers? If we only use one sanitizer, I suggest simplifying the config by removing the multiple sanitizer variant.

At last, I added a minimal test to verify the config works. During this test, I discovered the usage of a vendor_dir parameter. This couples the DI config to Composer's vendor directory conventions and package names. I replaced them with a relative import, which are relative to the config file location. In a future version of guides-cli, you may want to deprecate the vendor_dir parameter.

<raw-node sanitizer-name="custom" >
<sanitizer name="custom">
<allow-element>p</allow-element>
<allow-element name="p"/>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Both the old and new config work, but it's not (nicely) possible to combine simple type (string content) and complex type (attributes/child elements) in XSD. The schema has been updated to a complex type, to allow specifying the allowed attributes, which means this file had to be updated to conform to the new schema.

Copy link
Member

@jaapio jaapio left a comment

Choose a reason for hiding this comment

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

Thanks, I think most things have been done because I didn't know the better way to do this.
As all tests are passing we can safely merge this.

I agree with you that we should deprecate the old config keys that are no longer needed.

@jaapio jaapio merged commit 6f96acb into phpDocumentor:main Dec 28, 2025
58 checks passed
@wouterj wouterj deleted the sanitizer-config branch December 28, 2025 15:42
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.

2 participants