Phiki::codeToHtml()
signature changedPhiki\Output\Html\PendingHtmlOutput
instead of a raw string. This new object allows for more flexibility and lazy rendering of the final HTML output.
If you need to get the HTML string immediately, you can call the toString()
and __toString()
methods or cast it to a (string)
.
To improve the usability of this method, the following parameters have been removed:
withGutter
– replaced with a withGutter()
method on the returned object.withWrapper
– if you were using this, see the “Medium impact changes” section below for more information.Phiki\Environment\Environment
class is now Phiki\Environment
.Phiki\CommonMark\PhikiExtension
class is now Phiki\Adapters\CommonMark\PhikiExtension
.Phiki\Environment
instance to the Phiki
constructor has been removed.
This was a rarely used feature that added unnecessary complexity to the codebase.
Phiki
class.
If you need to register an extension, you can use the Phiki::extend()
method:
Phiki
class.
If you need to register a custom grammar, you can use the Phiki::grammar()
method:
Phiki::theme()
method:
getGrammarRepository()
or getThemeRepository()
methods on the Phiki\Environment\Environment
class, you can now access these repositories directly from the Phiki::$environment
property.
readonly
, so you cannot replace them, but you can still interact with them as you did before.
HtmlGenerator
class removedPhiki\Generators\HtmlGenerator
class has been removed. Its functionality has been integrated into the Phiki\Output\Html\PendingHtmlOutput
class returned by Phiki::codeToHtml()
.
php
and js
) for automatic detection which was not enough to be useful.
It’s now recommended that you always specify the language when using Phiki::codeToHtml()
or the Phiki CommonMark extension.
withWrapper
option removedwithWrapper: true
to Phiki::codeToHtml()
or the Phiki CommonMark extension, this feature has now been removed.
It was originally added to support a feature on my personal site but was never officially documented. Since there are alternative methods to achieve the same result, it has been removed to simplify the codebase.
Tokenizer
class has been completely rewritten to improve performance and accuracy.
It now uses PHP’s mbstring
extension since that uses Oniguruma under the hood, which is the same RegEx engine behind Shiki and vscode-textmate
.
This will only affect you if you were extending the Tokenizer
class since the underlying methods and properties have changed to accommodate the new implementation.
Highlighter
class has also been rewritten to improve accuracy.
The previous implementation uses a very naive approach to applying styles to scoped tokens which resulted in “scope selectors” not being applied correctly.
This has now been resolved in the new implementation at the cost of some performance.
Phiki\Tokenizer
is now Phiki\TextMate\Tokenizer
Phiki\Highlighter
is now Phiki\Highlighting\Highlighter