Skip to content

Releases: demyanovs/php-highlight

3.0.0

21 Nov 15:06
6717cba

Choose a tag to compare

Added

  • Support for <pre><code> pattern (in addition to <pre>) for better Markdown compatibility
  • Support for class="language-*" attribute on <code> tag for language detection
  • Fluent interface for showLineNumbers() and showActionPanel() methods
  • HighlighterFactory class for creating highlighter instances based on language
  • CodeBlockWrapper class for separating presentation logic from highlighting
  • LanguageNormalizer class for normalizing language identifiers with aliases support
  • Custom exceptions: InvalidLanguageException, InvalidThemeException, ThemeNotSetException
  • PHP as default language for code blocks without specified language
  • Comprehensive test suite

Changed

  • BREAKING: Removed Singleton pattern from all highlighter classes (HighlighterPHP, HighlighterXML, HighlighterBash)
  • BREAKING: Made HighlighterBase an abstract class (cannot be instantiated directly)
  • BREAKING: Added ext-dom PHP extension requirement (previously optional with regex fallback)
  • Improved HTML attribute parsing using DOMDocument with regex fallback
  • Enhanced syntax highlighting logic in HighlighterBase
  • Improved XML/HTML highlighting: fixed line-by-line processing, proper attribute highlighting
  • Updated PHPDoc comments throughout the codebase

Fixed

  • Fixed issue with extra empty lines at the beginning and end of code blocks
  • Fixed line numbering

2.1.0

13 Jun 20:54
98b5f20

Choose a tag to compare

  • Set PHP minimum version in composer
  • Throws UnknownThemeException
  • Added tests

2.0.0

03 Jun 22:18
4782063

Choose a tag to compare

  • Completely redesigned project structure
  • Updated syntaxes to PHP 8.1
  • Updated examples

1.1.1

15 Jan 19:26

Choose a tag to compare

Added C64 theme.

1.1.0

14 Sep 13:49
9e692ff

Choose a tag to compare

  • Fixed showing line number if there is only one line
  • Added themes: obsidian, far, vs2015
  • Changed examples
  • Other code changes and small fixes

1.0.1

03 Jun 19:41

Choose a tag to compare

Replaced css by class.