https://github.com/hydephp/bladedown
Experimental HydePHP extension blurring the lines between Blade and Markdown
https://github.com/hydephp/bladedown
Last synced: 10 months ago
JSON representation
Experimental HydePHP extension blurring the lines between Blade and Markdown
- Host: GitHub
- URL: https://github.com/hydephp/bladedown
- Owner: hydephp
- License: mit
- Created: 2024-02-04T10:09:54.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-06T17:35:32.000Z (almost 2 years ago)
- Last Synced: 2025-03-26T17:51:59.144Z (10 months ago)
- Language: PHP
- Homepage: https://hydephp.github.io/bladedown
- Size: 183 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Experimental HydePHP Bladedown Extension
**Blurring the lines between Blade and Markdown**
## Alpha software warning ⚠️
This package is currently a proof of concept, and is not even remotely ready for production use.
## Installation
You can install the package via Composer:
```bash
composer require hyde/bladedown
```
## Usage
This package adds a new "Bladematter" page type using `.blade.md`, which is a combination of Blade and Markdown. This allows you to use Blade directives in your Markdown files.
```markdown
---
name: World
---
# Hello, {{ $name }}!
Lorem Ipsum
Lorem ipsum dolor sit amet
## More stuff
Lorem ipsum dolor sit amet.
@include('related-posts')
@push('footer')
@endpush
```
## Supported components
**We currently support the following subset of components.**
As you can see, dynamic features like conditionals and loops are not supported.
This is because those kinds of things can quickly get complex, and it's more maintainable to keep that logic in dedicated component files.
Instead, the idea with this package is that you can easily include those components, and pass in the data you need.
### Echoing variables
All front matter properties are available as variables in the Bladedown file.
```markdown
---
name: World
---
# Hello, {{ $name }}!
```
### Including components
#### Classic templating syntax
```blade
@include('related-posts')
@include('related-posts', ['limit' => 5])
@component('faq-item')
@slot('question') How do I get started? @endslot
@slot('answer') Check our detailed documentation for step-by-step instructions. @endslot
@endcomponent
@component('faq-item')
@slot('question') Can I customize the appearance? @endslot
@slot('answer') Yes, the styles are easily customizable to fit your design. @endslot
@endcomponent
```
#### Newer component syntax
```markdown
Exciting Feature
This feature allows you to do incredible things!
```
### Pushing to stacks
The push directive allows you to push to any stack in your layout. Perfect if you need to add a script or style for a specific page.
```blade
@push('header')
## My header
@endpush
@push('footer')
console.log('Hello, World!');
@endpush
```
Note that only `@push` is supported and not similar ones like `@prepend` or conditional pushes.
## Information
### Contributing
Contributions are welcome. Please see the [hydephp/develop](https://github.com/hydephp/develop/issues) monorepo for details.
### Security Considerations
Remember that this package by design allows you to execute any arbitrary PHP code, regardless of the default HydePHP Markdown security settings.
The package assumes that you trust the authors of the Bladedown files, and take the same care as you would with any other PHP file in your project.
### Security Vulnerabilities
Please review the [security policy](../../security/policy) on how to report security vulnerabilities.
### License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.