Skip to content

Commit

Permalink
Merge pull request #747 from maxlysenko/feature/override-default-pars…
Browse files Browse the repository at this point in the history
…edown-processing

A way to override default Parsedown behavior
  • Loading branch information
rhukster committed Apr 6, 2016
2 parents d28e7bc + 7b3c02c commit 9d2ef02
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions system/src/Grav/Common/Markdown/ParsedownGravTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,13 @@ protected function init($page, $defaults)
* @param $type
* @param $tag
*/
public function addBlockType($type, $tag, $continuable = false, $completable = false)
public function addBlockType($type, $tag, $continuable = false, $completable = false, $index = null)
{
$this->BlockTypes[$type] [] = $tag;
if (!isset($index)) {
$this->BlockTypes[$type] [] = $tag;
} else {
array_splice($this->BlockTypes[$type], $index, 0, $tag);
}

if ($continuable) {
$this->continuable_blocks[] = $tag;
Expand All @@ -82,10 +86,17 @@ public function addBlockType($type, $tag, $continuable = false, $completable = f
* @param $type
* @param $tag
*/
public function addInlineType($type, $tag)
public function addInlineType($type, $tag, $index = null)
{
$this->InlineTypes[$type] [] = $tag;
$this->inlineMarkerList .= $type;
if (!isset($index)) {
$this->InlineTypes[$type] [] = $tag;
} else {
array_splice($this->InlineTypes[$type], $index, 0, $tag);
}

if (strpos($this->inlineMarkerList, $type) === false) {
$this->inlineMarkerList .= $type;
}
}

/**
Expand Down

0 comments on commit 9d2ef02

Please sign in to comment.