Skip to content

Instantly share code, notes, and snippets.

@chobie
Last active December 28, 2015 23:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chobie/7578704 to your computer and use it in GitHub Desktop.
Save chobie/7578704 to your computer and use it in GitHub Desktop.
<?php
/**
* Dependency
*
* Sundown
* https://github.com/chobie/php-sundown
* https://github.com/chobie/Emoji
* https://github.com/chobie/Albino
*
*/
$markdown = new \Sundown\Markdown(new \Chobie\BlogBundle\Render\HtmlRender(["hard_wrap"=>true]),
["fenced_code_blocks"=>true,"table"=>true,"autolink"=>true]);
echo $markdown->render($markdown_content);
<?php
namespace Chobie\BlogBundle\Render;
class HtmlRender extends \Sundown\Render\HTML
{
protected $emoji;
public function __construct($options)
{
parent::__construct($options);
$this->emoji = new \Emoji(["emoji.path"=>"/assets/"]);
}
public function blockCode($code,$lang)
{
if (!empty($lang)) {
$code = \Albino::colorize($code,$lang);
$code = preg_replace("!</?pre>!","",$code);
}
return "<pre><code>" . trim($code) . "</code></pre>";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment