HTML5 support for SilverStripe

Package info

github.com/silverstripe/silverstripe-html5

Type:silverstripe-vendormodule

pkg:composer/silverstripe/html5

Statistics

Installs: 232 932

Dependents: 5

Suggesters: 0

Stars: 14

Open Issues: 0

2.4.0 2022-04-26 05:58 UTC

Requires

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

BSD-3-Clause f5a188b75a3c01571622d6c9331d30f62a6028e1

HTML5silverstripecwp


README

NOTE: This module is no longer commercially supported in Silverstripe CMS 5 and it does not provide a CMS5-compatible version. Since Silverstripe CMS 5 it's a part of core functionality.

👁 CI

Requirements

  • Silverstripe 4.0 or higher

For a Silverstripe 3.x compatible version of this module, please see the 1.0 branch, or 1.x release line.

This module is not compatible or required for Silverstripe CMS 5. HTML5 is natively used by Silverstripe CMS 5.

Summary

This module adds further HTML 5 support to SilverStripe.

Although Silverstripe supports using HTML 5 in templates out of the box, there are some limitations in the use of HTML in the content managed through the CMS.

HTMLText & HTMLVarchar

This module allows Silverstripe to support HTML 5 in HTMLText and HTMLVarchar fields, by providing a subclass of HTMLValue that uses the third party html5lib and causing the Injector to use this subclass by default.

Silverstripe stores HTMLText and HTMLVarchar fields in models as strings, but sometimes needs to convert these to DOM objects (for instance, to process shortcodes).

Default Silverstripe behavior is to do this with DOMDocument#loadHTML, but that method throws an error when it encounters the new HTML5 element types. It also doesn't deal with unclosed elements and invalid HTML in the manner prescribed by the HTML5 spec.

This module replaces the code that does this conversion with code that uses html5lib, which supports HTML 5 as per the spec.