-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
127 additions
and
7 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace Tempest\Highlight\Languages; | ||
|
||
class BladeLanguage extends HtmlLanguage | ||
{ | ||
public function getPatterns(): array | ||
{ | ||
return parent::getPatterns() + [ | ||
|
||
]; | ||
} | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
|
||
require_once __DIR__ . '/vendor/autoload.php'; | ||
|
||
passthru("php -S localhost:8080 -t tests/"); |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
require_once __DIR__ . '/../vendor/autoload.php'; | ||
|
||
use League\CommonMark\Environment\Environment; | ||
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension; | ||
use League\CommonMark\Extension\CommonMark\Node\Block\FencedCode; | ||
use League\CommonMark\MarkdownConverter; | ||
use Tempest\Highlight\CommonMark\HighlightCodeBlockRenderer; | ||
|
||
$environment = new Environment(); | ||
|
||
$environment | ||
->addExtension(new CommonMarkCoreExtension()) | ||
->addRenderer(FencedCode::class, new HighlightCodeBlockRenderer()); | ||
|
||
$markdown = new MarkdownConverter($environment); | ||
|
||
$contents = $markdown->convert(file_get_contents(__DIR__ . '/test.md'))->getContent(); | ||
|
||
?> | ||
|
||
<html> | ||
<head> | ||
<title>Test</title> | ||
<style> | ||
<?= file_get_contents(__DIR__ . '/../src/Themes/highlight-light-lite.css') ?> | ||
|
||
body { | ||
font-size: 15px; | ||
} | ||
|
||
pre { | ||
overflow-x: scroll; | ||
line-height: 1.8em; | ||
font-family: "JetBrains Mono", monospace; | ||
} | ||
|
||
.hl { | ||
width: 800px; | ||
margin: 3em auto; | ||
box-shadow: 0 0 10px 0 #00000044; | ||
padding: 1em 2em; | ||
background-color: #fafafa; | ||
border-radius: 3px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="hl"> | ||
<?= $contents ?> | ||
</div> | ||
</body> | ||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
```php | ||
declare(strict_types=1); | ||
|
||
namespace Tempest\Highlight; | ||
|
||
interface Injection | ||
{ | ||
public function parse(string $content, Highlighter $highlighter): string; | ||
} | ||
``` |