silverstripers/markdown
Composer 安装命令:
composer require silverstripers/markdown
包简介
Markdown DB field and form field for SilverStripe
README 文档
README
This module introduces a new DB field type Markdown & Markdown Editor. It uses github style Markdown style. And uses the simple markdown editor.
https://github.com/sparksuite/simplemde-markdown-editor
https://github.com/cebe/markdown
The module is still under development, but soon will be ready, with link popups and image selectors.
Installation
Use composer
composer require silverstripers/markdown dev-master
Basic Usage
To use the markdown DB field in your data objects the basic code would look like
class MyDataClass extends DataObject
{
private static $db = [
'MarkdownContent' => 'MarkdownText'
];
}
MarkdownText knows to add a markdown editor for your fields, but if you need to manually specify the type of field use
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldsToTab('Root.Sidebar', [
\SilverStripers\markdown\forms\MarkdownEditorField::create('MarkdownContent', 'Content'),
]);
return $fields;
}
Force all the fields to use Markdown
If you are looking to replace all the fields of HTMLText to markdown use the following configs in the config.yml.
This should override any instances of the HTMLText replacements with MarkdownText
---
Name: myconfigs
After:
- '#corefieldtypes'
---
SilverStripe\Core\Injector\Injector:
HTMLText:
class: SilverStripers\markdown\db\MarkdownText
Add preview styles
You can add your own CSS styles to the editor previews. This would let the users to check how their content will be displayed before they save in.
To achived this create a css file in mysite/css/ and name it as editor.css.
Your CSS rules have to be nested in a class so it wont affect other areas of the CMS.
.markdown-preview {
background-color: white;
padding: 20px;
font-size: 20px;
}
.markdown-preview h1 {
font-size: 30px;
}
If you are using a separate config and wanting to add styles to that EditorConfig you just add a new class name. This is possible because the fields adds the EditorConfig's identifier on to the preview pane. The below is an example for the default configs.
.markdown-preview.default {
background-color: white;
padding: 20px;
font-size: 14px;
line-height: 20px;
}
.markdown-preview.default h1 {
font-size: 24px;
line-height: 30px;
}
silverstripers/markdown 适用场景与选型建议
silverstripers/markdown 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 2.52k 次下载、GitHub Stars 达 11, 最近一次更新时间为 2017 年 11 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「module」 「markdown」 「silverstripe」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 silverstripers/markdown 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 silverstripers/markdown 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 silverstripers/markdown 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
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
Analytics chooser extensions for site settings.
CitaNZ's SilverStripe picture object and field for SilverStripe 4
bootstrap select field module implementing http://silviomoreto.github.io/bootstrap-select/
统计信息
- 总下载量: 2.52k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 11
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2017-11-02