Skip to content

Commit b094305

Browse files
authored
fix: TOC not showing every titles (#70)
1 parent 1ea2791 commit b094305

16 files changed

+25
-26
lines changed

app/Http/Controllers/ShowDocumentationController.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -200,13 +200,14 @@ protected function getNavigation(string $version): array
200200
protected function extractTableOfContents(string $document): array
201201
{
202202
// Remove code blocks which might contain headers.
203-
$document = preg_replace('(```[a-z]*\n[\s\S]*?\n```)', '', $document);
203+
$document = preg_replace('/```[a-z]*\s(.*?)```/s', '', $document);
204204

205205
return collect(explode(PHP_EOL, $document))
206206
->reject(function (string $line) {
207207
// Only search for level 2 and 3 headings.
208208
return ! Str::startsWith($line, '## ') && ! Str::startsWith($line, '### ');
209209
})
210+
210211
->map(function (string $line) {
211212
return [
212213
'level' => strlen(trim(Str::before($line, '# '))) + 1,

resources/views/docs/1/getting-started/configuration.md

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ title: Configuration
33
order: 200
44
---
55

6-
# Configuration
76

87
The `native:install` command publishes a configuration file to `config/nativephp.php`.
98
This file contains all the configuration options for NativePHP.

resources/views/docs/1/getting-started/debugging.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Debugging
33
order: 350
44
---
55

6-
# When things go wrong
6+
## When things go wrong
77

88
Building native applications is a complex task with many moving parts. There will be errors, crashes and lots of
99
head-scratching.
@@ -16,7 +16,7 @@ maintained by many developers outside the NativePHP team.**
1616

1717
This means that while some issues can be solved within NativePHP it's also very likely that the problem lies elsewhere.
1818

19-
## The layers
19+
### The layers
2020

2121
- Your application, built on Laravel, using your local installations of PHP & Node.
2222
- NativePHP's development tools (`native:serve` and `native:build`) manage the Electron/Tauri build processes - this is

resources/views/docs/1/getting-started/development.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Development
33
order: 300
44
---
55

6-
# Development
6+
## Development
77

88
```shell
99
php artisan native:serve
@@ -18,7 +18,7 @@ application to see changes.
1818

1919
This is known as 'running a dev build'.
2020

21-
## What does the `native:serve` command do?
21+
### What does the `native:serve` command do?
2222

2323
The `native:serve` command runs the Electron/Tauri 'debug build' commands, which build your application with various
2424
debug options set to help make debugging easier, such as allowing you to show the Dev Tools in the embedded web view.
@@ -59,7 +59,7 @@ Now changes you make to files in your source code will cause a hot reload in you
5959

6060
Which files trigger reloads will depend on your Vite configuration.
6161

62-
## `composer native:dev`
62+
### `composer native:dev`
6363

6464
You may find the `native:dev` script convenient. By default, it is setup to run both `native:serve` and `npm run dev`
6565
concurrently in a single command:

resources/views/docs/1/getting-started/env-files.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Environment Files
33
order: 400
44
---
55

6-
# Environment Files
6+
## Environment Files
77

88
When NativePHP bundles your application, it will copy your entire application directory into the bundle, including your
99
`.env` file.

resources/views/docs/1/getting-started/installation.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ title: Installation
33
order: 100
44
---
55

6-
# Requirements
6+
## Requirements
77

88
1. PHP 8.1+
99
2. Laravel 10 or higher
1010
3. Node 20+
1111
4. Windows 10+ / macOS 12+ / Linux
1212

13-
## PHP & Node
13+
### PHP & Node
1414

1515
The best development experience for NativePHP is to have PHP and Node running on your development machine directly.
1616

@@ -20,7 +20,7 @@ If you're using Mac or Windows, the most painless way to get PHP and Node up and
2020
Please note that, whilst it's possible to develop and run your application from a virtualized environment or container,
2121
you may encounter more unexpected issues and have more manual steps to create working builds.
2222

23-
## Laravel
23+
### Laravel
2424

2525
NativePHP is built to work best with Laravel. You can install it into an existing Laravel application, or
2626
[start a new one](https://laravel.com/docs/installation).

resources/views/docs/1/getting-started/introduction.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Introduction
33
order: 001
44
---
55

6-
# Hello, NativePHP!
6+
## Hello, NativePHP!
77

88
NativePHP is a new framework for rapidly building rich, native desktop applications using PHP. If you're already a PHP
99
developer, you'll feel right at home. If you're new to PHP, we think you'll find NativePHP easy to pick up and use.

resources/views/docs/1/getting-started/sponsoring.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Sponsoring
33
order: 002
44
---
5-
# Support NativePHP
5+
## Support NativePHP
66

77
NativePHP is wholly dependent on the dedication of its maintainers and contributors, who volunteer their free time to
88
ensure its continued development and improvement. As we prioritize our paid client work to sustain ourselves, your

resources/views/docs/1/publishing/building.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Building
33
order: 100
44
---
5-
# Building Your App
5+
## Building Your App
66

77
Building your app is the process of compiling your application into a production-ready state. When building, NativePHP
88
attempts to sign and notarize your application. Once signed, your app is ready to be distributed.

resources/views/docs/1/publishing/publishing.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Publishing
33
order: 200
44
---
5-
# Publishing Your App
5+
## Publishing Your App
66

77
Publishing your app is similar to building, but in addition NativePHP will upload the build artifacts to your chosen
88
[updater provider](/docs/publishing/updating) automatically.

resources/views/docs/1/publishing/updating.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Updating
33
order: 300
44
---
5-
# The Updater
5+
## The Updater
66
NativePHP ships with a built-in auto-update tool, which allows your users to update your application without needing to
77
manually download and install new releases.
88

resources/views/docs/1/the-basics/app-lifecycle.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Application Lifecycle
33
order: 1
44
---
55

6-
# NativePHP Application Lifecycle
6+
## NativePHP Application Lifecycle
77

88
When your NativePHP application starts - whether it's in development or production - it performs a series of steps to get your application up and running.
99

resources/views/docs/1/the-basics/screens.md

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
title: Screens
33
order: 850
44
---
5-
# Screens
65

76
The `Screen` facade lets you get information about the screens currently connected to the computer.
87

resources/views/docs/1/the-basics/shell.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Shell
33
order: 850
44
---
5-
# Shell operations
5+
## Shell operations
66

77
The `Shell` facade lets you perform some basic operations with files on the user's system in the context of the system's
88
default behaviour.
@@ -12,7 +12,7 @@ To use the `Shell` facade, add the following to the top of your file:
1212
use Native\Laravel\Facades\Shell;
1313
```
1414

15-
## Showing a file
15+
### Showing a file
1616

1717
The `showInFolder` method will attempt to open the given `$path` in the user's default file manager, e.g. File Explorer,
1818
Finder etc.
@@ -21,7 +21,7 @@ Finder etc.
2121
Shell::showInFolder($path);
2222
```
2323

24-
## Opening a file
24+
### Opening a file
2525

2626
The `openFile` method will attempt to open the given `$path` using the default application associated with that file
2727
type. If it was successful, this method will return an empty string (`""`); if unsuccessful, the returned string may
@@ -31,15 +31,15 @@ contain an error message.
3131
$result = Shell::openFile($path);
3232
```
3333

34-
## Trashing a file
34+
### Trashing a file
3535

3636
The `trashFile` method will attempt to send the given `$path` to the system's trash.
3737

3838
```php
3939
Shell::trashFile($path);
4040
```
4141

42-
## Open a URL
42+
### Open a URL
4343

4444
The `openExternal` method will attempt to open the given `$url` using the default handler registered for that URL's
4545
scheme on the system's, e.g. the `http` and `https` schemes will most likely open the user's default web browser.

resources/views/docs/1/the-basics/system.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: System
33
order: 800
44
---
5-
# The System
5+
## The System
66

77
One of the main advantages of building a native application is having more direct access to system resources, such as
88
peripherals connected to the physical device and APIs that aren't typically accessible inside a browser's sandbox.

resources/views/docs/index.blade.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
<div class="overflow-hidden lg:ml-[240px] max-w-prose w-full py-8 sm:px-8">
99

10-
<div class="text-5xl font-bold tracking-tight mb-4 text-[#00aaa6]">
10+
<h1 class="text-5xl font-bold tracking-tight mb-4 text-[#00aaa6]">
1111
{{$title}}
12-
</div>
12+
</h1>
1313

1414
<x-alert-beta/>
1515

0 commit comments

Comments
 (0)