Skip to content

Extends Parsedown to add support for server side code block rendering

License

Notifications You must be signed in to change notification settings

sixlive/parsedown-highlight

Repository files navigation

Parsedown Highlight

NOTE: This requires v1.8 of Parsedown, which has not been released yet.

Packagist Version Packagist Downloads Travis Code Quality Code Coverage StyleCI

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">&lt;?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 oss@tjmiller.co instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

Extends Parsedown to add support for server side code block rendering

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •