Skip to content

Commit

Permalink
Jlb/torchlight (laravel#205)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
taylorotwell and jasonlbeggs authored Feb 8, 2022
1 parent 617110a commit ec0756e
Show file tree
Hide file tree
Showing 72 changed files with 8,651 additions and 8,755 deletions.
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,7 @@ MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

ALGOLIA_ID=
ALGOLIA_SEARCH_KEY=

TORCHLIGHT_TOKEN=
TORCHLIGHT_LIGHT_THEME=github-light
TORCHLIGHT_DARK_THEME=github-dark
12 changes: 9 additions & 3 deletions app/Documentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

namespace App;

use Illuminate\Support\Str;
use Illuminate\Filesystem\Filesystem;
use App\Markdown\GithubFlavoredMarkdownConverter;
use Illuminate\Contracts\Cache\Repository as Cache;

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

if ($this->files->exists($path)) {
return $this->replaceLinks($version, (new Parsedown())->text($this->files->get($path)));
return $this->replaceLinks($version, (new GithubFlavoredMarkdownConverter())->convert($this->files->get($path)));
}

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

if ($this->files->exists($path)) {
return $this->replaceLinks($version, (new Parsedown)->text($this->files->get($path)));
$content = $this->files->get($path);

$content = (new GithubFlavoredMarkdownConverter())->convert($content);

return $this->replaceLinks($version, $content);
}

return null;
Expand All @@ -82,7 +88,7 @@ public function get($version, $page)
*/
public static function replaceLinks($version, $content)
{
return str_replace('{{version}}', $version, $content);
return str_replace('%7B%7Bversion%7D%7D', $version, $content);
}

/**
Expand Down
40 changes: 40 additions & 0 deletions app/Markdown/GithubFlavoredMarkdownConverter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace App\Markdown;

use League\CommonMark\MarkdownConverter;
use League\CommonMark\Environment\Environment;
use App\Markdown\GithubFlavoredMarkdownExtension;
use Torchlight\Commonmark\V2\TorchlightExtension;
use League\CommonMark\Environment\EnvironmentInterface;
use League\CommonMark\Extension\Attributes\AttributesExtension;
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;

/**
* Converts GitHub Flavored Markdown to HTML.
*/
class GithubFlavoredMarkdownConverter extends MarkdownConverter
{
/**
* Create a new Markdown converter pre-configured for GFM
*
* @param array<string, mixed> $config
*/
public function __construct(array $config = [])
{
$environment = new Environment($config);
$environment->addExtension(new CommonMarkCoreExtension());
$environment->addExtension(new GithubFlavoredMarkdownExtension());
$environment->addExtension(new AttributesExtension());
$environment->addExtension(new TorchlightExtension());

parent::__construct($environment);
}

public function getEnvironment(): EnvironmentInterface
{
\assert($this->environment instanceof EnvironmentInterface);

return $this->environment;
}
}
21 changes: 21 additions & 0 deletions app/Markdown/GithubFlavoredMarkdownExtension.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace App\Markdown;

use League\CommonMark\Extension\ExtensionInterface;
use League\CommonMark\Extension\Table\TableExtension;
use League\CommonMark\Extension\Autolink\AutolinkExtension;
use League\CommonMark\Extension\TaskList\TaskListExtension;
use League\CommonMark\Environment\EnvironmentBuilderInterface;
use League\CommonMark\Extension\Strikethrough\StrikethroughExtension;

final class GithubFlavoredMarkdownExtension implements ExtensionInterface
{
public function register(EnvironmentBuilderInterface $environment): void
{
$environment->addExtension(new AutolinkExtension());
$environment->addExtension(new StrikethroughExtension());
$environment->addExtension(new TableExtension());
$environment->addExtension(new TaskListExtension());
}
}
37 changes: 0 additions & 37 deletions app/Parsedown.php

This file was deleted.

4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
"fideloper/proxy": "^4.2",
"laravel/framework": "^8.0",
"laravel/tinker": "^2.2",
"symfony/browser-kit": "^5.0"
"symfony/browser-kit": "^5.0",
"torchlight/torchlight-commonmark": "^0.5.2",
"torchlight/torchlight-laravel": "^0.5.7"
},
"require-dev": {
"facade/ignition": "^2.3.6",
Expand Down
Loading

0 comments on commit ec0756e

Please sign in to comment.