vtalbot / markdown
Markdown compiler for Laravel 5
Installs: 128 929
Dependents: 3
Suggesters: 0
Security: 0
Stars: 100
Watchers: 6
Forks: 24
Open Issues: 6
Requires
- laravel/framework: ^5||^6||^7||^8
- michelf/php-markdown: ^1.8
Requires (Dev)
- mockery/mockery: 0.9.0
This package is auto-updated.
Last update: 2024-11-29 04:14:16 UTC
README
Installation
For Laravel 4
- Run
composer require vtalbot/markdown:1.5
- Run
php artisan config:publish vtalbot/markdown
- Then edit
config.php
inapp/config/packages/vtalbot/markdown
to your needs. - Add
'VTalbot\Markdown\MarkdownServiceProvider',
toproviders
inapp/config/app.php
and'Markdown' => 'VTalbot\Markdown\Facades\Markdown',
toaliases
inapp/config/app.php
For Laravel 5+
- Run
composer require vtalbot/markdown:2.0
- Run
php artisan vendor:publish --provider=“VTalbot\Markdown\MarkdownServiceProvider”
- Then edit
markdown.php
in yourconfig
directory to your needs. - Add
VTalbot\Markdown\MarkdownServiceProvider::class
toproviders
inconfig/app.php
and'Markdown' => VTalbot\Markdown\Facades\Markdown::class
toaliases
inconfig/app.php
Usage
http://domain.name/test.md
If test.md
doesn't exists in the public
directory, it will search for test.md
in app/markdown
directory.
If found, compile it if needed and return the result.
Markdown::make('file-in-markdown-directory');
Or, you can compile a simple string:
Markdown::string('#test');
To handle markdown file not found:
Markdown::setNotFoundHandler(function($file) { return 'Markdown file not found'; }); Markdown::setNotFoundHandler('MarkdownController@missing');
Configuration
For more information on the Markdown configuration, you may refer to http://michelf.ca/projects/php-markdown/configuration .
Changelog
2.0
- Add support for Laravel 5
1.5
- Change deprecated dependency.
- Add Markdown file not found handler.
- Add configurations based on the new dependency.
- Add some tests.