Last active
December 14, 2015 18:29
-
-
Save gwijayas/5130256 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: My Page | |
--- | |
Hi, My Name I Gede Wijaya. | |
Testing fenced code block | |
```php | |
<?php | |
echo phpinfo(); | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
site: | |
title: 'My New Website' | |
description: 'A website recently generated with PieCrust.' | |
author: jaya | |
pretty_urls: true | |
enable_debug_info: true | |
smartypants: | |
enable: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sundown |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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