parsedown-highlight
parsedown-highlight copied to clipboard
Extends Parsedown to add support for server side code block rendering
Parsedown Highlight
NOTE: This requires v1.8 of Parsedown, which has not been released yet.
This extends Parsedown to add support for server side code block rendering. This uses scrivo/highlight.php to do all the code block rendering. This will be fully compatible with Highlight JS.
Installation
You can install the package via composer:
> composer require sixlive/parsedown-highlight
Usage
# Hello!
Here is a post with some code in it.
\```php
<?php
echo 'foo';
\```
\```asldfh
put 'WHOOP!'
\```
$parsedown = new \sixlive\ParsedownHighlight;
$parsedown->text(file_get_contents(__DIR__.'/README.md'));
<h1>Hello!</h1>
<p>Here is a post with some code in it.</p>
<pre><code class="language-php hljs php"><span class="hljs-meta"><?php</span>
<span class="hljs-keyword">echo</span> <span class="hljs-string">'foo'</span>;</code></pre>
<pre><code class="language-asldfh">put 'WHOOP!'</code></pre>
Using Parsedown Extra
Note: This requires version 0.8.0-beta-1
$parsedown = new \sixlive\ParsedownHighlightExtra;
$parsedown->text(file_get_contents(__DIR__.'/README.md'));
Testing
> composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Code Style
In addition to the php-cs-fixer rules, StyleCI will apply the Laravel preset.
Linting
> composer styles:lint
Fixing
> composer styles:fix
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- TJ Miller
- All Contributors
License
The MIT License (MIT). Please see License File for more information.