diff --git a/.github/alto-code-highlight.svg b/.github/alto-code-highlight.svg new file mode 100644 index 0000000..e5ddd3a --- /dev/null +++ b/.github/alto-code-highlight.svg @@ -0,0 +1,16 @@ + + + ALTO Code Highlight + Install with composer require alto/code-highlight. + + + diff --git a/README.md b/README.md index 1ad097b..ba9ffe8 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,19 @@ -# ALTO Code Highlight +

+ + ALTO Code Highlight + +

Server-side syntax highlighting for PHP applications, with semantic scopes, embedded languages, and no third-party PHP package dependencies at runtime. -  ![PHP Version](https://img.shields.io/badge/PHP-8.4%2B-00B7FF?logoColor=00B7FF&labelColor=050608) -  ![CI](https://img.shields.io/github/actions/workflow/status/altophp/code-highlight/CI.yml?branch=main&label=Tests&labelColor=050608&color=00B7FF) -  [![Packagist](https://img.shields.io/packagist/v/alto/code-highlight?label=Packagist&labelColor=050608&color=00B7FF)](https://packagist.org/packages/alto/code-highlight) -  ![License](https://img.shields.io/github/license/altophp/code-highlight?label=License&labelColor=050608&color=00B7FF) -  [![GitHub Sponsors](https://img.shields.io/github/sponsors/smnandre?logo=githubsponsors&logoColor=00B7FF&label=%20Sponsor&labelColor=050608&color=00B7FF)](https://github.com/sponsors/smnandre) +

+ PHP Version + CI + Packagist + License + GitHub Sponsors +

![PHP highlighted with the Alto Dark theme](docs/assets/examples/alto-dark/php.png) @@ -16,21 +22,6 @@ process, or external service. Its parsers assign semantic scopes, so themes can distinguish a function definition from a call or a type definition from a reference. -## Installation - -Install ALTO Code Highlight with Composer: - -```bash -composer require alto/code-highlight -``` - -ALTO Code Highlight requires PHP 8.4 or later, Mbstring, and Tokenizer. -Tokenizer is included with PHP; Mbstring is available in most PHP distributions -but must be enabled. - -See the [installation guide](docs/installation.md) for verification and -troubleshooting. - ## Quick Start ```php @@ -51,6 +42,21 @@ echo $highlighter->highlight($code, 'php'); `
…
`. Emit a theme stylesheet once per page, then reuse the highlighter for every code block. +## Installation + +Install ALTO Code Highlight with Composer: + +```bash +composer require alto/code-highlight +``` + +ALTO Code Highlight requires PHP 8.4 or later, Mbstring, and Tokenizer. +Tokenizer is included with PHP; Mbstring is available in most PHP distributions +but must be enabled. + +See the [installation guide](docs/installation.md) for verification and +troubleshooting. + ## Parse without rendering Use `CodeParser` when another component needs semantic tokens instead of HTML: