- Support for asymmetric visibility
- Include quotes in PHP and JS strings
- Normalize newline formats (#150)
- Fix for extra added spaces at the start of lines (#145)
- Fix for trimming code when using gutter (#146)
- Support unicode tokens in standardizing line endings (#143)
- Fix for promoted property hooks (#110)
- Fix for blade echo highlighting within comments (#113)
- Fix for static property types (#129)
- Fix for attribute in promoted property (#133)
- Fix for comments in function argument lists (#134)
- Fix for variadic types (#140)
- Fix for functions called "new" (#141)
- Add Inspired GitHub theme (#139)
- Fix unicode tokens bug (#136)
- Add Dockerfile support (#135)
- Rename BOOLEAN token to LITERAL token (#128)
- Add missing classes in default themes (#127)
- Add Python support (#121)
- Add additional tokens for numbers and booleans (#123)
- Improve line splitting for addition and deletion injections (#117)
- Bugfix for single-line return type docblock (#122)
- Bugfix for missing type highlight in property set hook
- Improve Ellison line splitting
- Small improvements to Ellison support
- Add Ellison support (#116)
- Improved line splitting for gutter (#115)
- Add
class="notranslate"
to pre tags to prevent Google Translate from translating code blocks (#114)
- Fix blade comments being styled as deletions (#10)
- Bugfixes
- Several bugfixes
- Add
\Tempest\Highlight\CommonMark\HighlightExtension
- Add
Highlighter::getSupportedLanguageNames()
- Add support for
diff
language
- Fix for overflowing highlight tags
- Fix for custom class overflows
- Attribute highlighting bugfix
- Bugfix for arrays within attributes
Language
interface has two new methods:getName
andgetAliases
interface Language
{
+ public function getName(): string;
+ public function getAliases(): array;
…
}
BaseLanguage
is now abstractHighlighter::setLanguage
is renamed toHighlighter::addLanguage
and its signature was changed:
- public function setLanguage(string $name, Language $language): self
+ public function addLanguage(Language $language): self
- A new
TextLanguage
was added - Rename
WithPre
toWebTheme
data-lang
now also works forInlineTheme
- interface WithPre
+ interface WebTheme extends Theme
- Changes to
WebTheme
method signatures:
- public function preBefore(): string;
- public function preAfter(): string;
+ public function preBefore(Highlighter $highlighter): string;
+ public function preAfter(Highlighter $highlighter): string;
- Moved all CSS themes from
src/Themes
tosrc/Themes/Css
- Injections can now only return
ParsedInjection
. If you happen to have custom injections that return strings, then those strings can simply be wrapped within aParsedInjection
:return new ParsedInjection($content)
.
interface Injection
{
- public function parse(string $content, Highlighter $highlighter): string|ParsedInjection;
+ public function parse(string $content, Highlighter $highlighter): ParsedInjection;
}
- Return type of
Pattern::getTokenType()
changed fromTokenTypeEnum
toTokenType
interface Pattern
{
- public function getTokenType(): TokenTypeEnum;
+ public function getTokenType(): TokenType;
}
Highlighter::withGutter()
is now an immutable function- Support for PHP's property hooks
- Fallback for preg JIT exhaustion
- Fix bug with FQCN and
::class
- Fix bug where two or more
style
tags within the same HTML file caused an error - Fix CSS media query bug
- Fix missing CSS selector tokens bug
- Add
data-lang
attribute to pre tags (#90)
- Fix blur bleed bug (#89)
- Added a collection of themes (#87)
- Added a new
InlineTheme
, which doesn't require loading a CSS style sheet (#88)
- Added Gutter support:
$highlighter = (new \Tempest\Highlight\Highlighter())->withGutter();
Note: three new classes have been added for gutter support. If you copied over an existing theme, you'll need to add these:
.hl-gutter {
display: inline-block;
font-size: 0.9em;
color: #555;
padding: 0 1ch;
}
.hl-gutter-addition {
background-color: #34A853;
color: #fff;
}
.hl-gutter-deletion {
background-color: #EA4334;
color: #fff;
}
Note: This package doesn't account for pre
tag styling. You might need to make adjustments to how you style pre
tags if you enable gutter support.