Download the PHP package zhenhaihou/commonmark-highlighter without Composer
On this page you can find all versions of the php package zhenhaihou/commonmark-highlighter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download zhenhaihou/commonmark-highlighter
More information about zhenhaihou/commonmark-highlighter
Files in zhenhaihou/commonmark-highlighter
Package commonmark-highlighter
Short Description Highlight your markdown code blocks with 升级league/commonmark版本,添加表格,删除线的转换
License MIT
Homepage https://github.com/zhenhaihou/commonmark-highlighter
Informations about the package commonmark-highlighter
Highlight your markdown code blocks with league/commonmark
A block renderer for league/commonmark to highlight code blocks using scrivo/highlight.php.
highlight.php is a server side code highlighter written in PHP that currently supports 185 languages. It's a port of highlight.js by Ivan Sagalaev that makes full use of the language and style definitions of the original JavaScript project.
The output html is compatible with highlight.js themes, which you can explore on highlightjs.org.
What are the benefits of using this package over highlight.js?
- Less JavaScript, which means faster page loads
-
No more flash of unstyled code blocks
This project was inspired by sixlive/parsedown-highlight.
Installation
You can install the package via composer:
Usage
Create a custom CommonMark environment, and register the FencedCodeRenderer
and IndentedCodeRender
as described in the league/commonmark documentation.
The underlying highlight library recommends specifying a subset of languages for the auto-detection. You can pass an array of languages to any of the renderers.
Highlighting specific lines
Line numbers start at 1.
```php - Don't highlight any lines
```php{4} - Highlight just line 4
```php{4-6} - Highlight the range of lines from 4 to 6 (inclusive)
```php{1,5} - Highlight just lines 1 and 5 on their own
```php{1-3,5} - Highlight 1 through 3 and then 5 on its own
```php{5,7,2-3} - The order of lines don't matter
However, specifying 3-2 will not work.
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Postcardware
You're free to use this package, but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.
Our address is: Spatie, Samberstraat 69D, 2060 Antwerp, Belgium.
We publish all received postcards on our company website.
Credits
- Sebastian De Deyne
- All Contributors
Support us
Spatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects on our website.
Does your business depend on our contributions? Reach out and support us on Patreon. All pledges will be dedicated to allocating workforce on maintenance and new awesome stuff.
License
The MIT License (MIT). Please see License File for more information.