From fda36519d7e4c3fbafce239d4b3d4462e95cfd6c Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Tue, 14 Nov 2023 20:38:51 +0100 Subject: [PATCH 1/3] Format documentation Markdown --- docs/creating-content/documentation-pages.md | 1 + docs/digging-deeper/customization.md | 8 ++------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/docs/creating-content/documentation-pages.md b/docs/creating-content/documentation-pages.md index a8ce3d5b3df..11c04ac81b1 100644 --- a/docs/creating-content/documentation-pages.md +++ b/docs/creating-content/documentation-pages.md @@ -294,6 +294,7 @@ navigation menu items are hidden. The page will still be accessible as normal bu The Realtime Compiler that powers the `php hyde serve` command will automatically generate a fresh search index each time the browser requests it. + ## Automatic "Edit Page" button ### Introduction diff --git a/docs/digging-deeper/customization.md b/docs/digging-deeper/customization.md index 538f92301e1..e2ef574b1ec 100644 --- a/docs/digging-deeper/customization.md +++ b/docs/digging-deeper/customization.md @@ -217,7 +217,7 @@ Learn more in the [Navigation Menu](navigation-menus) documentation. #### Customizing the documentation sidebar - To customize the sidebar, use the setting `sidebar_order` in the `docs.php` config. -- When customizing the sidebar, can use the route key, or just the [page identifier](core-concepts#page-identifiers) of the page. +- When customizing the sidebar, can use the route key, or just the [page identifier](core-concepts#page-identifiers) of the page. Learn more in the [Documentation Pages](documentation-pages) documentation. @@ -231,7 +231,7 @@ However, some pages are autoconfigured to have a lower priority, for example, th #### Basic syntax for changing the priorities -The cleanest way is to use the list-style syntax where each item will get the priority calculated according to its position in the list, plus an offset of `500`. +The cleanest way is to use the list-style syntax where each item will get the priority calculated according to its position in the list, plus an offset of `500`. The offset is added to make it easier to place pages earlier in the list using front matter or with explicit priority settings. ```php @@ -316,7 +316,6 @@ navigation: hidden: true --- - #### Adding Custom Navigation Menu Links You can easily add custom navigation menu links similar how we add Authors. Simply add a `NavItem` model to the `navigation.custom` array. @@ -354,14 +353,12 @@ php hyde publish:views The files will then be available in the `resources/views/vendor/hyde` directory. - ## Frontend Styles Hyde is designed to not only serve as a framework but a whole starter kit and comes with a Tailwind starter template for you to get up and running quickly. If you want to customize these, you are free to do so. Please see the [Managing Assets](managing-assets) page to learn more. - ## Markdown Configuration Hyde uses [League CommonMark](https://commonmark.thephpleague.com/) for converting Markdown into HTML, and @@ -424,7 +421,6 @@ arbitrary PHP code specified in Markdown to be executed. It's easy to enable how See the [Blade in Markdown](advanced-markdown#blade-support) documentation for more information on how to use this feature. - ## YAML Configuration The settings in the `config/hyde.php` file can also be set by using a `hyde.yml` file in the root of your project directory. From d457f2787020dbf240f9f1a0ee5693220aec32f1 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Tue, 14 Nov 2023 20:37:45 +0100 Subject: [PATCH 2/3] Revamp extensions documentation Improves heading structure, and vastly expands on the realtime compiler documentation --- docs/digging-deeper/extensions.md | 46 +++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 9 deletions(-) diff --git a/docs/digging-deeper/extensions.md b/docs/digging-deeper/extensions.md index 269272b4c9e..36e6ad64c52 100644 --- a/docs/digging-deeper/extensions.md +++ b/docs/digging-deeper/extensions.md @@ -6,27 +6,55 @@ navigation: # Extensions and Integrations -## First party extensions +# First party extensions -### Realtime Compiler -The Hyde Realtime Compiler is now included with Hyde -installations and is what powers the `php hyde serve` command. +## Realtime Compiler + +The Hyde Realtime Compiler is included with Hyde installations and is what powers the `php hyde serve` command, +allowing you to preview your static site on a local development server without having to rebuild the site. + +### Usage + +To start the server, run the following command from a terminal in your project directory: + +```bash +php hyde serve +``` + +This will start a local development server at `http://localhost:8080` + +### Configuration + +The server can be configured in the `config/hyde.php` file to change the port, host, and to customize its features. + +```php +// filepath config/hyde.php + +'server' => [ + 'port' => env('SERVER_PORT', 8080), + 'host' => env('SERVER_HOST', 'localhost'), + 'save_preview' => true, +], +``` + +### Source code - **GitHub**: [hydephp/realtime-compiler](https://github.com/hydephp/realtime-compiler) - **Packagist**: [hydephp/realtime-compiler](https://packagist.org/packages/hyde/realtime-compiler) -- **YouTube video**: [Introducing the Hyde Realtime Compiler](https://www.youtube.com/watch?v=1ZM4fQMKi64) +--- + +# Integrations with third-party tools -## Integrations with third-party tools -### Torchlight +## Torchlight Torchlight is an amazing API for syntax highlighting, and is used by this site. I cannot recommend it highly enough, especially for documentation sites and code-heavy blogs! As such, HydePHP has built-in support for Torchlight, which is automatically enabled once you add an API token to your `.env` file. Nothing else needs to be done! -#### Getting started +### Getting started To get started you need an API token which you can get at [Torchlight.dev](https://torchlight.dev/). It is entirely free for personal and open source projects, as seen on their [pricing page](https://torchlight.dev/#pricing). @@ -38,7 +66,7 @@ Once a token is set, Hyde will automatically enable the CommonMark extension. TORCHLIGHT_TOKEN=torch_ ``` -#### Attribution and configuration +### Attribution and configuration Note that for the free plan you need to provide an attribution link. Thankfully Hyde injects a customizable link automatically to all pages that use Torchlight. You can of course disable and customize this in the `config/torchlight.php` file. From ae8835fd27c93490e61b097187c15e3fb1951bcd Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Tue, 14 Nov 2023 15:40:52 +0100 Subject: [PATCH 3/3] Change internal console context handling --- packages/realtime-compiler/src/ConsoleOutput.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/realtime-compiler/src/ConsoleOutput.php b/packages/realtime-compiler/src/ConsoleOutput.php index 50976736f58..a96cd0329be 100644 --- a/packages/realtime-compiler/src/ConsoleOutput.php +++ b/packages/realtime-compiler/src/ConsoleOutput.php @@ -64,7 +64,7 @@ public function getFormatter(): Closure /** @experimental */ public function printMessage(string $message, string $context): void { - $this->output->writeln(sprintf('%s [%s]', $message, $context)); + $this->output->writeln(sprintf('%s ::context=[%s]', $message, $context)); } protected function handleOutput(string $buffer): void @@ -92,8 +92,8 @@ protected function formatLineForOutput(string $line): ?string if (str_ends_with(trim($line), 'Accepted') || str_ends_with(trim($line), 'Closing')) { return $this->verbose ? $this->formatRequestStatusLine($line) : null; } - if (str_contains($line, '[dashboard@')) { - return $this->formatDashboardContextLine($line); + if (str_contains($line, '::context=')) { + return $this->formatContextLine($line); } return $this->formatLine($line, Carbon::now()); @@ -126,10 +126,10 @@ protected function formatRequestStatusLine(string $line): string return $this->formatLine(sprintf('%s %s', $address, $status), $this->parseDate($line)); } - protected function formatDashboardContextLine(string $line): string + protected function formatContextLine(string $line): string { - $message = trim(Str::before($line, '[dashboard@')); - $context = trim(trim(Str::after($line, $message)), '[]'); + $message = trim(Str::before($line, '::context='), '[]'); + $context = Str::between($line, '::context=[', ']'); $success = str_contains($message, 'Created') || str_contains($message, 'Updated'); return $this->formatLine($message, Carbon::now(), $success ? 'green-500' : 'blue-500', $context);