PHP code example of northernco / markdown-bundle
1. Go to this page and download the library: Download northernco/markdown-bundle library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
northernco / markdown-bundle example snippets
// config/bundles.php
return [
// ...
Northern\MarkdownBundle\NorthernMarkdownBundle::class => ['all' => true],
];
use Northern\MarkdownBundle\Service\MarkdownParserInterface;
use Northern\MarkdownBundle\Service\MarkdownRepositoryInterface;
class Service {
private $parser;
private $repository;
public function __construct(
MarkdownParserInterface $parser,
MarkdownRepositoryInterface $repository
) {
$this->parser = $parser;
$this->repository = $repository;
}
public function someMethod()
{
$text = '# Test';
// Converts the markdown
$html = $this->parser->convertMarkdownToHtml($text);
// or convert and cache the markdown
$html = $this->repository->getHtmlFromMarkdown($text);
}
}