Skip to content

Commit

Permalink
Add getters for docParser/HtmlRenderer/extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
dshafik committed Dec 31, 2014
1 parent 4ded741 commit b271c02
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/CommonMarkConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,20 @@ public function convertToHtml($commonMark)

return $this->htmlRenderer->renderBlock($documentAST);
}

/**
* @return DocParser
*/
public function getDocParser()
{
return $this->docParser;
}

/**
* @return HtmlRenderer
*/
public function getHtmlRenderer()
{
return $this->htmlRenderer;
}
}
12 changes: 12 additions & 0 deletions src/Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@

class Environment
{
/**
* @var ExtensionInterface[]
*/
protected $extensions;

/**
* @var BlockParserInterface[]
*/
Expand Down Expand Up @@ -218,6 +223,8 @@ public function createInlineParserEngine()
*/
public function addExtension(ExtensionInterface $extension)
{
$this->extensions[] = $extension;

// Block parsers
foreach ($extension->getBlockParsers() as $blockParser) {
$this->addBlockParser($blockParser);
Expand All @@ -243,6 +250,11 @@ public function addExtension(ExtensionInterface $extension)
$this->addInlineRenderer($class, $inlineRenderer);
}
}

public function getExtensions()
{
return $this->extensions;
}

/**
* @return Environment
Expand Down
8 changes: 8 additions & 0 deletions src/HtmlRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,12 @@ public function renderBlocks($blocks, $inTightList = false)

return implode($this->options['blockSeparator'], $result);
}

/**
* @return Environment
*/
public function getEnvironment()
{
return $this->environment;
}
}

0 comments on commit b271c02

Please sign in to comment.