Skip to main content
Phiki provides the Phiki\Transformers\AddClassesTransformer transformer out of the box, which allows you to automatically add scope-based CSS classes to HTML elements.

Usage

To use the AddClassesTransformer, apply it to your pending HTML content:
The generated HTML will include CSS classes based on the scope names for each token, for example phiki-source.php. You can then use these classes in your CSS to style specific elements:

Disabling style attributes

If you want to disable the inline style attributes added by Phiki, you can pass the styles: false argument to the constructor.
This will result in HTML elements for tokens that only have the class attribute, allowing you to fully control the styling through CSS.