Skip to content

Commit 76a4ffc

Browse files
authored
Merge pull request #5 from Xoshbin/develop
Develop
2 parents bdac972 + 3769a21 commit 76a4ffc

37 files changed

+1380
-492
lines changed

README.md

Lines changed: 127 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,28 @@ Pertuk is a powerful Laravel documentation package that provides a complete docu
1111

1212
## Features
1313

14-
- 📖 **Markdown Processing**: Full CommonMark and GitHub Flavored Markdown support
14+
- 📖 **Premium Markdown**: Full CommonMark and GitHub Flavored Markdown support
15+
- 🎨 **Shiki Syntax Highlighting**: Server-side, VS-Code quality syntax highlighting
1516
- 🌍 **Multi-Language Support**: Built-in support for English, Kurdish, and Arabic
16-
- 🔍 **Search Functionality**: Built-in search with JSON index
17-
- 🎨 **Beautiful UI**: Responsive design with dark mode support
17+
- 🔍 **Deep Local Search**: Full-content indexing via MiniSearch with relevancy scoring
18+
- 🧩 **Interactive Components**: Built-in support for Tabs and Accordions in Markdown
19+
- 🎨 **Modern UI**: Responsive design with interactive sidebar and dark mode
1820
- 📱 **Mobile Friendly**: Optimized for all device sizes
1921
- 🗂️ **Auto Table of Contents**: Automatic TOC generation from headings
20-
- 💾 **Caching**: Intelligent caching for performance
22+
- 💾 **Intelligent Caching**: High-performance document rendering and caching
2123
- 🧭 **Breadcrumbs**: Automatic breadcrumb navigation
2224
- 🏷️ **Front Matter Support**: YAML front matter for metadata
25+
- 💡 **Admonitions**: Support for tip, warning, and danger callouts
26+
- 🚀 **Pre-rendering**: Artisan command to pre-render documentation for maximum speed
2327

2428
## Configuration
2529

2630
This is the contents of the published config file:
2731

2832
```php
2933
return [
30-
// Root folder for documentation files
34+
// Root folder for documentation files.
35+
// Place markdown files under per-locale folders (e.g., docs/en/payments.md).
3136
'root' => base_path('docs'),
3237

3338
// Default sort order when front matter 'order' is missing
@@ -62,38 +67,60 @@ return [
6267
composer require xoshbin/pertuk
6368
```
6469

65-
2. (Optional) Publish the config:
70+
2. Publish the assets (JS and CSS):
71+
72+
```bash
73+
php artisan vendor:publish --tag="pertuk-assets"
74+
```
75+
76+
3. (Optional) Publish the config:
6677

6778
```bash
6879
php artisan vendor:publish --tag="pertuk-config"
6980
```
7081

71-
3. Create a `docs` directory and add a markdown file, e.g. `docs/getting-started.md`.
82+
4. Ensure you have the frontend dependencies installed if you are building assets yourself:
83+
84+
```bash
85+
npm install minisearch alpinejs @alpinejs/collapse
86+
```
87+
88+
5. Create a `docs/en` directory and add a markdown file, e.g. `docs/en/getting-started.md`.
7289

73-
4. Visit your docs at `/docs` (or `/{route_prefix}` if you changed `pertuk.route_prefix`).
90+
6. Visit your docs at `/docs` (redirects to default locale) or `/docs/en` directly.
7491

75-
- Optional: publish the views to customize the layout and markup:
92+
- **Customization**: Publish the views to customize the layout and markup:
7693

7794
```bash
7895
php artisan vendor:publish --tag="pertuk-views"
7996
```
8097

98+
7. (Optional) Pre-render documentation for performance:
99+
```bash
100+
php artisan pertuk:build
101+
```
102+
81103
## Usage
82104

83105
### Document Structure
84106

107+
Files must be organized by locale subdirectory.
108+
85109
```
86110
docs/
87-
├── getting-started.md
88-
├── User Guide/
89-
│ ├── installation.md # default (en)
90-
│ ├── installation.ckb.md # Kurdish
91-
│ ├── installation.ar.md # Arabic
92-
│ └── configuration.md
93-
├── Developer Guide/
94-
│ ├── api.md
95-
│ └── examples.md
96-
└── advanced.md
111+
├── en/ # English (default)
112+
│ ├── getting-started.md
113+
│ ├── User Guide/
114+
│ │ ├── installation.md
115+
│ │ └── configuration.md
116+
│ └── advanced.md
117+
├── ckb/ # Kurdish
118+
│ ├── getting-started.md
119+
│ └── User Guide/
120+
│ ├── installation.md
121+
│ └── configuration.md
122+
└── ar/ # Arabic
123+
└── getting-started.md
97124
```
98125

99126
### Front Matter
@@ -110,15 +137,92 @@ order: 1
110137
Your markdown content here...
111138
```
112139

140+
### Interactive Components (Alpine.js)
141+
142+
Pertuk includes built-in interactive components powered by Alpine.js. These can be used directly in your Markdown files.
143+
144+
#### Tabs
145+
146+
Use tabs to group related content, like code examples in different languages.
147+
148+
```html
149+
<x-pertuk-tabs>
150+
<x-pertuk-tab name="PHP">
151+
152+
```php
153+
echo "Hello World";
154+
```
155+
156+
</x-pertuk-tab>
157+
<x-pertuk-tab name="JS">
158+
159+
```javascript
160+
console.log("Hello World");
161+
```
162+
163+
</x-pertuk-tab>
164+
</x-pertuk-tabs>
165+
```
166+
167+
#### Accordion
168+
169+
Use accordions for collapsible sections like FAQs.
170+
171+
```html
172+
<x-pertuk-accordion>
173+
<x-pertuk-accordion-item title="Can I customize the design?">
174+
175+
Yes! You can publish the views and CSS to match your brand's identity.
176+
177+
</x-pertuk-accordion-item>
178+
<x-pertuk-accordion-item title="What about performance?">
179+
180+
Pertuk uses intelligent caching and server-side rendering for lightning-fast speeds.
181+
182+
</x-pertuk-accordion-item>
183+
</x-pertuk-accordion>
184+
```
185+
186+
### Admonitions
187+
188+
Use special blocks for callouts:
189+
190+
```markdown
191+
::: tip
192+
This is a helpful tip.
193+
:::
194+
195+
::: warning
196+
Be careful with this setting.
197+
:::
198+
199+
::: danger
200+
This action cannot be undone.
201+
:::
202+
```
203+
113204
### Multi-Language Support
114205

115-
Create language-specific versions by adding locale suffixes:
206+
Docs must be placed in a subdirectory matching the locale code defined in `config/pertuk.php`. The structure is strict: `docs/{locale}/{slug}.md`.
116207

117208
```
118209
docs/
119-
├── getting-started.md # English (default)
120-
├── getting-started.ckb.md # Kurdish
121-
└── getting-started.ar.md # Arabic
210+
├── en/
211+
│ └── intro.md
212+
├── ckb/
213+
│ └── intro.md
214+
└── ar/
215+
└── intro.md
216+
```
217+
218+
### Performance & Deployment
219+
220+
To ensure maximum performance in production, you can pre-render all documentation files into the cache. This eliminates the need for parsing Markdown on the first request.
221+
222+
Run the following command during your deployment process:
223+
224+
```bash
225+
php artisan pertuk:build
122226
```
123227

124228
## Testing

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@
2020
],
2121
"require": {
2222
"php": "^8.4 || ^8.3",
23-
"spatie/laravel-package-tools": "^1.16",
2423
"illuminate/contracts": "^11.0||^12.0",
2524
"league/commonmark": "^2.0",
25+
"spatie/commonmark-shiki-highlighter": "^2.5",
26+
"spatie/laravel-package-tools": "^1.16",
27+
"spatie/shiki-php": "^2.3",
2628
"spatie/yaml-front-matter": "^2.0"
2729
},
2830
"require-dev": {

config/pertuk.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,8 @@
3838
'ar' => 'العربية',
3939
],
4040

41+
// GitHub Repo & Branch for "Edit on GitHub" links
42+
'github_repo' => env('PERTUK_GITHUB_REPO', 'username/repo'),
43+
'github_branch' => env('PERTUK_GITHUB_BRANCH', 'main'),
44+
4145
];

dist/pertuk.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/pertuk.js

Lines changed: 22 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 41 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
"watch": "vite build --watch"
88
},
99
"dependencies": {
10+
"@alpinejs/collapse": "^3.15.6",
1011
"@tailwindcss/vite": "^4.1.13",
11-
"highlight.js": "^11.11.1",
12+
"alpinejs": "^3.15.6",
1213
"laravel-vite-plugin": "^2.0.1",
14+
"minisearch": "^7.2.0",
1315
"tailwindcss": "^4.1.13",
1416
"vite": "^7.1.5"
1517
}

0 commit comments

Comments
 (0)