Skip to content

Repository files navigation

ALTO Twig Code Highlight

Highlight source code directly from Twig templates with a tag or filter powered by ALTO Code Highlight.

  PHP Version   CI   Packagist   License   GitHub Sponsors

Use the block tag for source written in a template or the filter for source provided by your application:

{% code_highlight 'php' %}
<?php echo 'Hello, Alto!';
{% endcode_highlight %}

{{ source|code_highlight('javascript') }}

Installation

composer require alto/twig-code-highlight

The package requires PHP 8.4 or later, ALTO Code Highlight 1.x, and Twig 3.28 or later.

Documentation

Contributing

Contributions of all kinds are welcome. Visit the project on GitHub to report a bug, suggest a feature, or open a pull request.

Before submitting code, run:

# Runs PHP CS Fixer, PHPStan, and PHPUnit
composer qa

Changes to public behavior should include tests and documentation.

Support

ALTO Twig Code Highlight is open source and independently maintained by Simon André. If it is useful to your work, you can support its continued development through GitHub Sponsors.

Sharing the package or starring it on GitHub also helps.

License

ALTO Twig Code Highlight is released by ALTO PHP under the MIT License.

About

Twig extension for alto/code-highlight: {% code_highlight %} tag and |code_highlight filter for server-side highlighting

Topics

Resources

Code of conduct

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Contributors

Languages