vtalbot/markdown
Markdown Compiler for Laravel
Installation
For Laravel 4
- Run
composer require vtalbot/markdown:1.5 - Run
php artisan config:publish vtalbot/markdown - Then edit
config.phpinapp/config/packages/vtalbot/markdownto your needs. - Add
'VTalbot\Markdown\MarkdownServiceProvider',toprovidersinapp/config/app.phpand'Markdown' => 'VTalbot\Markdown\Facades\Markdown',toaliasesinapp/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.phpin yourconfigdirectory to your needs. - Add
VTalbot\Markdown\MarkdownServiceProvider::classtoprovidersinconfig/app.phpand'Markdown' => VTalbot\Markdown\Facades\Markdown::classtoaliasesinconfig/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
| Key | Default value | Description |
|---|---|---|
paths |
array('/markdown') |
Directory where to find the markdown files. |
routes |
array('',) |
Routes prefixes. |
extensions |
array('markdown','md') |
Extensions used to set routes. |
add_routes |
true |
Enable the creation of routes. |
empty_element_suffix |
' />' |
Suffix for empty element (br, hr). |
tab_width |
4 |
Tab character width. |
no_markup |
false |
Prevent HTML tags to be passed to output. |
no_entities |
false |
Convert entities like < to &. |
predef_urls |
array() |
Add reference for urls. array('ref' => '//goo.gl'): [google][ref] |
predef_titles |
array() |
Same as predef_urls. |
use_extra |
true |
Use Markdown with extra, eg.: fenced code block. |
fn_id_prefix |
'' |
Prefix for ID attributes generated by footnotes. |
fn_link_title |
'' |
Title for footnotes links. |
fn_backlink_title |
'' |
Same as fn_link_title. |
fn_link_class |
'footnote-ref' |
CSS class for footnotes links and backlinks. |
fn_backlink_class |
'footnote-backref' |
Same as fn_link_class. |
code_class_prefix |
'' |
Prepend CSS class to fenced code block. |
code_attr_on_pre |
false |
Put attributes on pre instead of code. |
predef_abbr |
array() |
Create predefine abbreviations. |
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.
Related Packages
aspose/pdf-sdk-php
Aspose.PDF Cloud is a REST API for creating and editing PDF files. It can also b...
33,669
8
.net
annotation
api
aspose
aspose.pdf
aspose.pdf-cloud
aspose.total-cloud
bmp
circle-annotation
cloud
convert
convert-pdf
converter
create-pdf
csharp
doc
doc-to-pdf
docx
docx-to-pdf
dotnet
emf
epub
epub-to-pdf
extract-image
fdf
fetch-text
gif
html
html-to-pdf
jpeg
line-annotation
markdown
markdown-to-pdf
md
md-to-pdf
mht
mht-to-pdf
mobixml
ocr-layers
pcl
pcl-to-pdf
pdf
pdf-attachment
pdf-bookmark
pdf-document
pdf-form-fields
pdf-image
pdf-link
pdf-ocr
pdf-page
pdf-text
pdf-to-doc
pdf-to-docx
pdf-to-epub
pdf-to-html
pdf-to-image
pdf-to-mobixml
pdf-to-pdfa
pdf-to-pptx
pdf-to-svg
pdf-to-tex
pdf-to-tiff
pdf-to-xfa
pdf-to-xls
pdf-to-xml
pdf-to-xps
pdfa3
png
postscript
postscript-to-pdf
pptx
ps
ps-to-pdf
replace-image
replace-text
rest
square-annotation
squiggly-annotation
stamp
svg
svg-to-pdf
tex
tex-to-pdf
text
tiff
underline-annotation
web-to-pdf
xfdf
xls
xlsx
xml
xml-to-pdf
xps
xps-to-pdf
xsif-to-pdf
xslfo