nachonerd/silex-markdown-provider
最新稳定版本:1.0.4
Composer 安装命令:
composer require nachonerd/silex-markdown-provider
包简介
Silex Service Provider using cebe/markdown
README 文档
README
Description
Silex Service Provider using cebe/markdown. cebe/markdown was created by Carsten Brandt.
License
GPL-3.0
Requirements
- PHP version 5.4
- Composer
- SILEX
- Synfony Finder
- cebe/markdown
- PHP Unit 4.7.x (optional)
- PHP_CodeSniffer 2.x (optional)
Install
composer require nachonerd/silex-markdown-provider
Usage
Include following line of code somewhere in your initial Silex file (index.php or whatever):
... $app->register( new \NachoNerd\Silex\Markdown\Provider(), array( "nn.markdown.path" => __DIR__, "nn.markdown.flavor" => 'extra', "nn.markdown.filter" => '/\.md/' ) ); ...
Now you have access to instance of cebe/markdown throw $app['nn.markdown'].
Twig Extension
Filters
- markdown_parse Parse specified text to html
{{ "## Some text"|markdown_parse }}
.....
{{ texttoparse|markdown_parse }}
- markdown_parse_file Parse specified file to html
{{ "some/file.md"|markdown_parse_file }}
.....
{{ filename|markdown_parse_file }}
Functions
- markdown_parse_last_file Parse last file in markdown,path directory to html
{{ markdown_parse_last_file() }}
Example
<?php require_once __DIR__.'/../vendor/autoload.php'; $app = new Silex\Application(); // Considering the config.yml files is in the same directory as index.php $app->register( new \NachoNerd\Silex\Finder\Provider(), array( "nn.markdown.path" => __DIR__, "nn.markdown.flavor" => original, "nn.markdown.filter" => '/\.md/' ) ); $app->boot(); ... // traditional markdown and parse full text $parser = $app[nn.markdown]; $hmtl = $parser->parse($markdown); $hmtl = $parser->parseFile($filename); $finder = $parser->getAllFiles($filename); $finder = $parser->getNLastFiles(10); ...
统计信息
- 总下载量: 87
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0
- 更新时间: 2015-09-09