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

Make HTMLValue default to HTML5 parsing in CMS5 #10528

Closed
5 tasks
maxime-rainville opened this issue Oct 7, 2022 · 1 comment
Closed
5 tasks

Make HTMLValue default to HTML5 parsing in CMS5 #10528

maxime-rainville opened this issue Oct 7, 2022 · 1 comment

Comments

@maxime-rainville
Copy link
Contributor

maxime-rainville commented Oct 7, 2022

Blocked by #10402 - we need to remove silverstripe/html5 from recipe-kitchen-sink - though there isn't yet an up to date CMS 5 branch. recipe kitchen sink is the only place that needs to have silverstripe/html5 removed from it. Also delete the 3 branch from silverstripe/html5 when this is unblocked

The silverstripe/html5 module relies on some ancient unmaintained library. Arguably, HTML5 is now ubiquitous and it should be the default anyway.

What library to use

We could use symfony/dom-crawler to do the parsing. The latest versions uses masterminds/html5 internally to parse HTML5. We could also use masterminds/html5 directly.

silverstripe/behat-extension already uses symfony/dom-crawler.

There's probably other libraries we could use out there.

Acceptance criteria

  • CMS5 HTMLValue parses HTML strings as HTML5.
  • HTML5 parsing in CMS5 is achieved with a recent well supported library.
  • Pre-existing HTML data can be migrated to HTML5 when preforming a CMS5 upgrade.
    • This could happen on save when the value is edited.
    • Maybe this needs a dedicated migration task.
  • The silverstripe/html5 read me calls out that the module won't be needed in CMS5.
  • silverstripe/html5 is removes from the CMS5 kitchen sink and any other supported modules.

Notes

  • I don't know that we need a way to fallback to HTML4.
    • If there's a path for people to use their own parser, either by making our the parser Injectable or by using the Injector to subclass HTMLValue (like the current html5 module does), that would be a plus but probably not worth officially supporting.
  • The migration path could be something like "the next time you save your HTML field the content gets converted to an HTML5 string". I don't know that this is obviously problematic. It could be worth having a dedicated task for it.

PRs

TODO

  • Remove silverstripe/html5 from CMS 5 recipe-kitchen-sink composer.json (currently there is no valid CMS 5 branch)
@maxime-rainville
Copy link
Contributor Author

Called out the need to removed silverstripe/html5 from the sink https://github.com/silverstripe/recipe-kitchen-sink/pull/26/files#r1072901298

Everything else is done.

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

3 participants