Skip to content

Commit b094305

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

File tree

16 files changed

+25
-26
lines changed

16 files changed

+25
-26
lines changed

app/Http/Controllers/ShowDocumentationController.php

Lines changed: 2 additions & 1 deletion
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

Lines changed: 0 additions & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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.

0 commit comments

Comments
 (0)