Skip to content

[FEAT] add support for raw html sanitizers #1125

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

Merged
merged 2 commits into from
Oct 11, 2024
Merged

Conversation

jaapio
Copy link
Member

@jaapio jaapio commented Oct 8, 2024

This feature introduces a new compiler pass that will allow us to sanitize the html in a raw directive. We can disable the full raw usage by setting raw_node.escape to true this will block all html and displays the raw node as normal paragraph.

By default the raw directive is displayed as is and sanitized to safe html, when raw is defined as html content

.. raw:: html

   <p>html here</p>

if the raw language is different than html we no nothing for now.

This pr also allows the users to define there own html sanitizer from the configuration. Example can be found in the included test.

@jaapio jaapio requested a review from linawolf October 8, 2024 21:04
@linawolf
Copy link
Contributor

Working on fixing the phpstan issues

jaapio and others added 2 commits October 11, 2024 13:10
This feature introduces a new compiler pass that will allow us to
sanitize the html in a raw directive. We can disable the full raw
usage by setting `raw_node.escape` to `true` this will block all
html and displays the raw node as normal paragraph.

By default the raw directive is displayed as is and sanitized to
safe html, when raw is defined as html content

```
.. raw:: html

   <p>html here</p>
```

if the raw language is different than html we no nothing for now.

This pr also allows the users to define there own html sanitizer
from the configuration. Example can be found in the included test.
@linawolf
Copy link
Contributor

Thanks, looks good to me

@jaapio jaapio merged commit 5ad233a into main Oct 11, 2024
41 checks passed
@jaapio jaapio deleted the feature/sanitize-raw-html branch October 11, 2024 11:25
@phpdoc-bot
Copy link

💔 All backports failed

Status Branch Result
1.x Backport failed because of merge conflicts

You might need to backport the following PRs to 1.x:
- Add deprecation trigger for context extension

Manual backport

To create the backport manually run:

backport --pr 1125

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

@jaapio
Copy link
Member Author

jaapio commented Oct 11, 2024

💚 All backports created successfully

Status Branch Result
1.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

jaapio added a commit that referenced this pull request Oct 11, 2024
[1.x] Merge pull request #1125 from phpDocumentor/feature/sanitize-raw-html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants