Skip to content

Instantly share code, notes, and snippets.

@gwijayas
Last active December 14, 2015 18:29
Show Gist options
  • Save gwijayas/5130256 to your computer and use it in GitHub Desktop.
Save gwijayas/5130256 to your computer and use it in GitHub Desktop.
---
title: My Page
---
Hi, My Name I Gede Wijaya.
Testing fenced code block
```php
<?php
echo phpinfo();
```
site:
title: 'My New Website'
description: 'A website recently generated with PieCrust.'
author: jaya
pretty_urls: true
enable_debug_info: true
smartypants:
enable: false
<?php
use PieCrust\IPieCrust;
use PieCrust\Formatters\IFormatter;
class SundownFormatter implements IFormatter
{
protected $pieCrust;
public function initialize(IPieCrust $pieCrust)
{
}
public function getPriority()
{
return IFormatter::PRIORITY_HIGH;
}
public function isExclusive()
{
return true;
}
public function supportsFormat($format)
{
return preg_match('/markdown|mdown|mkdn?|md/i', $format);
}
public function format($text)
{
$sundown_options = array(
'no_intra_emphasis' => false,
'tables' => true,
'fenced_code_blocks' => true,
'autolink' => true,
'strikethrough' => true,
'lax_html_blocks' => false,
'space_after_headers' => true,
'superscript' => false,
'filter_html' => false,
'no_images' => false,
'no_links' => false,
'no_styles' => false,
'safe_links_only' => false,
'with_toc_data' => false,
'hard_wrap' => true,
'xhtml' => true,
);
$render = new \Sundown\Render\HTML();
$sd = new \Sundown\Markdown($render);
$sd->setExtensions($sundown_options);
return $sd->render($text);
}
}
<?php
require_once 'src/SundownFormatter.php';
use PieCrust\PieCrustPlugin;
class SundownPlugin extends PieCrustPlugin
{
public function getName()
{
return "Sundown";
}
public function getFormatters()
{
return array(
new SundownFormatter()
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment