承接 alfredo-ramos/parsedown-extra-laravel 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

alfredo-ramos/parsedown-extra-laravel

Composer 安装命令:

composer require alfredo-ramos/parsedown-extra-laravel

包简介

A Parsedown Extra package for Laravel

README 文档

README

About

A Parsedown Extra package for Laravel.

HTML Purifier is also used to filter the HTML output, protecting your application for insecure content. Additionally, HTML5 Definitions for HTML Purifier is used to add new definitions and sanitization for HTML5.

Build Status Latest Stable Version Code Quality License

Compatibility

Version Laravel Lumen Status
0.8.x >= 5.5.x, < 6.x.x >= 5.5.x, < 6.x.x End of life
1.x.x 6.x.x 6.x.x End of life
2.x.x 7.x.x 7.x.x End of life
3.x.x 8.x.x 8.x.x End of life
4.x.x 9.x.x 9.x.x End of life
5.x.x 10.x.x 10.x.x End of life
6.x.x 11.x.x 11.x.x Active support
7.x.x 12.x.x N/A Active support

Installation

Run the following command on your terminal:

composer require 'alfredo-ramos/parsedown-extra-laravel:^7.0.0'

Laravel

Service providers and aliases will be registered automatically since Laravel 5.5.x, thanks to the new package auto-discovery.

Lumen

Support for Lumen has been dropped since version 7.x.x. If you need this package for Lumen up to version 11.x.x, please install the previous major version 6.0.0

Usage

The Markdown::parse() method is responsible to transform the Markdown syntax into HTML, its signature is the following:

Markdown::parse(string $text = '', array $config = [])
Parameter Data type Default value Required Description
$text string '' Yes Markdown text
$config array, string [] No Extra configuration for HTML Purifier

Notes:

  • If $config is a string, it will be trated as an array key in the ['purifier']['settings'] array.
  • If $config is an array it will extend default configuration for HTML Purifier.
  • An empty value for $config means that it will use default values for HTML Purifier, see \AlfredoRamos\ParsedownExtra\HTMLPurifierLaravel::getConfig() for more information.

Using $config as a string

Markdown::parse('Hello world', ['config' => 'comments'])

Where comments is the key of the array settings.

return [
	'purifier'	=> [
		'enabled'	=> true,
		'settings'	=> [
			'default' => [...],
			'comments' => [...]
		]
	]
];

Using $config as an array

Markdown::parse('[DuckDuckGo](https://duckduckgo.com/)', ['config' => [
	'URI.Host' => 'localhost',
	'URI.DisableExternal' => true
]])

For all configuration options see the official HTML Purifier config docs.

Using default settings

Markdown::parse('Hello world!')
// Is the same as
Markdown::parse('Hello world!', ['config' => 'default'])

Blade

It can be used in Blade through the Markdown facade:

{!! Markdown::parse("Hello world") !!}
{!! Markdown::parse("[XSS link](javascript:alert('xss'))") !!}

The code above will print:

<p>Hello world</p>

<!-- HTML Purifier enabled -->
<p><a>XSS link</a></p>

<!-- HTML Purifier disabled -->
<p><a href="javascript:alert('xss')">XSS link</a></p>

Helper

For your convenience, the markdown() helper function is also available. It accepts the same parameters as the facade.

markdown('Hello world', ['purifier' => false])

Configuration

To add new or edit the default options, run the following command to make a copy of the default configuration file:

php artisan vendor:publish \
	--provider='AlfredoRamos\ParsedownExtra\ParsedownExtraServiceProvider' \
	--tag=config --force

alfredo-ramos/parsedown-extra-laravel 适用场景与选型建议

alfredo-ramos/parsedown-extra-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 155.51k 次下载、GitHub Stars 达 27, 最近一次更新时间为 2015 年 01 月 29 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「markdown」 「laravel」 「parsedown」 「markdown-extra」 「parsedown-extra」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 alfredo-ramos/parsedown-extra-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 alfredo-ramos/parsedown-extra-laravel 我们能提供哪些服务?
定制开发 / 二次开发

基于 alfredo-ramos/parsedown-extra-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 155.51k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 30
  • 点击次数: 15
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 27
  • Watchers: 3
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2015-01-29