Skip to content

Commit ec0756e

Browse files
Jlb/torchlight (#205)
* Update Tailwind, Alpine, and colors * Upgrade to Laravel 8 * wip * Implement new home page design * updating text * formatting * Search improvements * compile * Fix search colors * compile * formatting * wip * Add Octane to the ecosystem * fixes * wip * Add Breeze to ecosystem * formatting * Update testimonials section * wip * add more testimonials * Update testimonials * Use Torchlight dark mode * Fix markdown issues * wip * wip * compile * Try using dark cod eblocks. * Dark code all the way * Add torchlight attribution * Add attribute commonmark extension * remove unneeded code Co-authored-by: Jason Beggs <[email protected]>
1 parent 617110a commit ec0756e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+8651
-8755
lines changed

.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,7 @@ MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
4545

4646
ALGOLIA_ID=
4747
ALGOLIA_SEARCH_KEY=
48+
49+
TORCHLIGHT_TOKEN=
50+
TORCHLIGHT_LIGHT_THEME=github-light
51+
TORCHLIGHT_DARK_THEME=github-dark

app/Documentation.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
namespace App;
44

5+
use Illuminate\Support\Str;
56
use Illuminate\Filesystem\Filesystem;
7+
use App\Markdown\GithubFlavoredMarkdownConverter;
68
use Illuminate\Contracts\Cache\Repository as Cache;
79

810
class Documentation
@@ -46,7 +48,7 @@ public function getIndex($version)
4648
$path = base_path('resources/docs/'.$version.'/documentation.md');
4749

4850
if ($this->files->exists($path)) {
49-
return $this->replaceLinks($version, (new Parsedown())->text($this->files->get($path)));
51+
return $this->replaceLinks($version, (new GithubFlavoredMarkdownConverter())->convert($this->files->get($path)));
5052
}
5153

5254
return null;
@@ -66,7 +68,11 @@ public function get($version, $page)
6668
$path = base_path('resources/docs/'.$version.'/'.$page.'.md');
6769

6870
if ($this->files->exists($path)) {
69-
return $this->replaceLinks($version, (new Parsedown)->text($this->files->get($path)));
71+
$content = $this->files->get($path);
72+
73+
$content = (new GithubFlavoredMarkdownConverter())->convert($content);
74+
75+
return $this->replaceLinks($version, $content);
7076
}
7177

7278
return null;
@@ -82,7 +88,7 @@ public function get($version, $page)
8288
*/
8389
public static function replaceLinks($version, $content)
8490
{
85-
return str_replace('{{version}}', $version, $content);
91+
return str_replace('%7B%7Bversion%7D%7D', $version, $content);
8692
}
8793

8894
/**
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
namespace App\Markdown;
4+
5+
use League\CommonMark\MarkdownConverter;
6+
use League\CommonMark\Environment\Environment;
7+
use App\Markdown\GithubFlavoredMarkdownExtension;
8+
use Torchlight\Commonmark\V2\TorchlightExtension;
9+
use League\CommonMark\Environment\EnvironmentInterface;
10+
use League\CommonMark\Extension\Attributes\AttributesExtension;
11+
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
12+
13+
/**
14+
* Converts GitHub Flavored Markdown to HTML.
15+
*/
16+
class GithubFlavoredMarkdownConverter extends MarkdownConverter
17+
{
18+
/**
19+
* Create a new Markdown converter pre-configured for GFM
20+
*
21+
* @param array<string, mixed> $config
22+
*/
23+
public function __construct(array $config = [])
24+
{
25+
$environment = new Environment($config);
26+
$environment->addExtension(new CommonMarkCoreExtension());
27+
$environment->addExtension(new GithubFlavoredMarkdownExtension());
28+
$environment->addExtension(new AttributesExtension());
29+
$environment->addExtension(new TorchlightExtension());
30+
31+
parent::__construct($environment);
32+
}
33+
34+
public function getEnvironment(): EnvironmentInterface
35+
{
36+
\assert($this->environment instanceof EnvironmentInterface);
37+
38+
return $this->environment;
39+
}
40+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace App\Markdown;
4+
5+
use League\CommonMark\Extension\ExtensionInterface;
6+
use League\CommonMark\Extension\Table\TableExtension;
7+
use League\CommonMark\Extension\Autolink\AutolinkExtension;
8+
use League\CommonMark\Extension\TaskList\TaskListExtension;
9+
use League\CommonMark\Environment\EnvironmentBuilderInterface;
10+
use League\CommonMark\Extension\Strikethrough\StrikethroughExtension;
11+
12+
final class GithubFlavoredMarkdownExtension implements ExtensionInterface
13+
{
14+
public function register(EnvironmentBuilderInterface $environment): void
15+
{
16+
$environment->addExtension(new AutolinkExtension());
17+
$environment->addExtension(new StrikethroughExtension());
18+
$environment->addExtension(new TableExtension());
19+
$environment->addExtension(new TaskListExtension());
20+
}
21+
}

app/Parsedown.php

Lines changed: 0 additions & 37 deletions
This file was deleted.

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
"fideloper/proxy": "^4.2",
1414
"laravel/framework": "^8.0",
1515
"laravel/tinker": "^2.2",
16-
"symfony/browser-kit": "^5.0"
16+
"symfony/browser-kit": "^5.0",
17+
"torchlight/torchlight-commonmark": "^0.5.2",
18+
"torchlight/torchlight-laravel": "^0.5.7"
1719
},
1820
"require-dev": {
1921
"facade/ignition": "^2.3.6",

0 commit comments

Comments
 (0)