haleks/laravel-markdown
最新稳定版本:0.3.1
Composer 安装命令:
composer require haleks/laravel-markdown
包简介
Laravel Markdown integrate markdown 'curly' braces inside the blade template engine, adding view extension and also giving the possibility of extending CommonMark.
关键字:
README 文档
README
Laravel Markdown
Laravel Markdown integrate markdown "curly" braces inside the blade template engine, also giving the possibility of extending CommonMark.
Abandoned
Abandoned in favor of the more flexible Writedown. Which add supports for multiple markdown parsers.
Documentation
Pre-Installation
This project requires that the following packages be formerly installed.
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
Installation
Pulling the package
Install via composer's require command:
composer require haleks/laravel-markdown
Install via your projects' composer.json:
{
...
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"haleks/laravel-markdown": "0.3.*"
},
...
}
Once the package is in the require section you will need to run composer's install or update command to pull in the code:
# Install composer install -o # or Update composer update -o
Note: The trailing -o is an optional option which is used to optimize the autoloader and is considered best practice.
Registering the package
Once the package as been successfully pulled you will need to register the package's service provider to the Laravel's app and optionally add the package's facade by modifying config/app.php:
... 'providers' => [ ... Haleks\Markdown\MarkdownServiceProvider::class, ], ... 'aliases' => [ ... // Optional facade 'Markdown' => Haleks\Markdown\Facades\Markdown::class, ], ...
Configuration
Laravel Markdown supports optional configuration.
You will need to pull the configuration in you app's configuration folder to make modifications to the default configuration. You can achieve this with the following artisan command:
php artisan vendor:publish
The configuration file will be created at config/markdown.php.
Options
Enable Markdown Tags
The option tags specifies if you wish to extend blade with markdown tags. If set to true you will be able to render markdown via the "curly" braces {% %} inside your blade.php files.
Enable Views Extensions
The option views specifies if you wish to intergrate extend views extensions. If set to true you will be able to render markdown views with the following extensions: *.md, *.md.php, and *.md.blade.php.
Enable Views Extensions
The option extensions specifies which extension you wish to intergrate inside the CommonMark converter. It uses CommonMark environment's addExtension() method to load the extensions.
How To Use
Facades
You may use the facade to pass markdown and return the equivalent html. The Markdown facade has simply one method convertToHtml('markdown here').
Inside classes
$html = Markdown::convertToHtml('# title');
Blade Views
You will need to use the unescaped echo because the converter returns html.
{!! Markdown::convertToHtml('# title') !!}
Tags Extensions
If the tags configuration is set to true. You may use the following "curly" brace short-cut in your *.blade.php files.
{% '# title' %}
Like Blade's escaped echo {{ }} the markdown tags are also equipped with the short-cut ternary statement. If the pass variable that doesn't exists the markdown will only parse the default.
{% $variable or 'default' %}
If you are using a JavaScript template engine which uses the markdown "curly" braces, just like Blade's "curly" braces, you may add a leading @ to leave it untouched for the JavaScript template engine.
@{% javascript stuff %}
Views Extensions
If the views configuration is set to true. You may use views with the following extensions: *.md, *.md.php, and *.md.blade.php. The *.md views will parse the markdown and return the html equivalent, while the *.md.php, and *.md.blade.php will parse the php first and followed by the markdown.
// *.md # title text
// *.md.php # <?php echo 'title' ?> text
// *.md.php <?php echo '# title' ?> text
// *.md.blade.php # {{ 'title' }} text
// *.md.blade.php {{ '# title' }} text
All the exemple above will output:
<h1>title</h1> <p>text</p>
Markdown Extensions
You may extend the Markdown compiler with any extension that uses CommonMark environment addExtension() method.
Here are a few extension known to be compatible:
License
Laravel Markdown is licensed under The MIT License (MIT).
haleks/laravel-markdown 适用场景与选型建议
haleks/laravel-markdown 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7.75k 次下载、GitHub Stars 达 7, 最近一次更新时间为 2015 年 09 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「framework」 「markdown」 「laravel」 「Laravel Markdown」 「Laravel-Markdown」 「commonmark」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 haleks/laravel-markdown 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 haleks/laravel-markdown 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 haleks/laravel-markdown 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP Framework HLEB2 is the foundation of the web application. Provides ease of development and application performance.
Texy converts plain text in easy to read Texy syntax into structurally valid (X)HTML. It supports adding of images, links, nested lists, tables and has full support for CSS. Texy supports hyphenation of long words (which reflects language rules), clickable emails and URL (emails are obfuscated again
Adds more BBCode
Creates a markdown changelog for your GitHub repository.
Lightweight Application To Convert WordPress Readme Into Github Markdown
Alfabank REST API integration
统计信息
- 总下载量: 7.75k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-09-03