Skip to content

Commit

Permalink
Added code highlighter
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyhuy committed Jan 4, 2020
1 parent 2b741cb commit e67a485
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 17 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"php": "^7.1.3",
"ext-json": "*",
"laravel/framework": "~5.6.0|~5.7.0|~5.8.0|^6.0|^7.0",
"league/commonmark": "^1.1.0"
"league/commonmark": "^1.1.0",
"spatie/commonmark-highlighter": "^2.1"
},
"require-dev": {
"mockery/mockery": "^1.2",
Expand Down
38 changes: 22 additions & 16 deletions src/UsefulCommonMarkExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,36 @@

namespace JohnnyHuy\Laravel;

use Illuminate\Contracts\Container\BindingResolutionException;
use JohnnyHuy\Laravel\Inline\Element\Gist;
use Illuminate\Contracts\Container\Container;
use JohnnyHuy\Laravel\Inline\Element\Codepen;
use JohnnyHuy\Laravel\Inline\Element\YouTube;
use JohnnyHuy\Laravel\Block\Element\BlockColor;
use JohnnyHuy\Laravel\Block\Element\TextAlignment;
use JohnnyHuy\Laravel\Block\Parser\ColorParser;
use JohnnyHuy\Laravel\Block\Parser\TextAlignmentParser;
use JohnnyHuy\Laravel\Block\Renderer\ColorBlockRenderer;
use JohnnyHuy\Laravel\Block\Renderer\TextAlignmentRenderer;
use JohnnyHuy\Laravel\Inline\Element\Codepen;
use JohnnyHuy\Laravel\Inline\Element\Gist;
use JohnnyHuy\Laravel\Inline\Element\InlineColor;
use JohnnyHuy\Laravel\Inline\Parser\GistParser;
use League\CommonMark\Block\Element\FencedCode;
use JohnnyHuy\Laravel\Inline\Element\SoundCloud;
use JohnnyHuy\Laravel\Inline\Element\YouTube;
use JohnnyHuy\Laravel\Inline\Parser\CloseColorParser;
use JohnnyHuy\Laravel\Inline\Element\InlineColor;
use League\CommonMark\Block\Element\IndentedCode;
use JohnnyHuy\Laravel\Block\Element\TextAlignment;
use JohnnyHuy\Laravel\Inline\Parser\CodepenParser;
use JohnnyHuy\Laravel\Inline\Parser\GistParser;
use JohnnyHuy\Laravel\Inline\Parser\YouTubeParser;
use JohnnyHuy\Laravel\Inline\Renderer\GistRenderer;
use League\CommonMark\Extension\ExtensionInterface;
use JohnnyHuy\Laravel\Inline\Parser\OpenColorParser;
use Spatie\CommonMarkHighlighter\FencedCodeRenderer;
use JohnnyHuy\Laravel\Inline\Parser\CloseColorParser;
use JohnnyHuy\Laravel\Inline\Parser\SoundCloudParser;
use JohnnyHuy\Laravel\Inline\Parser\YouTubeParser;
use JohnnyHuy\Laravel\Inline\Renderer\CodepenRenderer;
use JohnnyHuy\Laravel\Inline\Renderer\ColorInlineRenderer;
use JohnnyHuy\Laravel\Inline\Renderer\GistRenderer;
use JohnnyHuy\Laravel\Inline\Renderer\SoundCloudRenderer;
use JohnnyHuy\Laravel\Inline\Renderer\YouTubeRenderer;
use Spatie\CommonMarkHighlighter\IndentedCodeRenderer;
use JohnnyHuy\Laravel\Block\Parser\TextAlignmentParser;
use League\CommonMark\ConfigurableEnvironmentInterface;
use League\CommonMark\Extension\ExtensionInterface;
use JohnnyHuy\Laravel\Block\Renderer\ColorBlockRenderer;
use JohnnyHuy\Laravel\Inline\Renderer\SoundCloudRenderer;
use JohnnyHuy\Laravel\Inline\Renderer\ColorInlineRenderer;
use JohnnyHuy\Laravel\Block\Renderer\TextAlignmentRenderer;
use Illuminate\Contracts\Container\BindingResolutionException;

/**
* This is the useful CommonMark extension class.
Expand Down Expand Up @@ -92,6 +96,8 @@ public function __construct(Container $container)
$this->blockRenderers = [
TextAlignment::class => $container->make(TextAlignmentRenderer::class),
BlockColor::class => $container->make(ColorBlockRenderer::class),
FencedCode::class => $container->make(FencedCodeRenderer::class),
IndentedCode::class => $container->make(IndentedCodeRenderer::class),
];
}

Expand Down

0 comments on commit e67a485

Please sign in to comment.