neoground/charm-markdown
Composer 安装命令:
composer require neoground/charm-markdown
包简介
Charm Markdown Module
README 文档
README
Welcome to the charm-markdown module, a remarkable addition to the Charm Framework galaxy, designed to provide seamless integration of Markdown and YAML frontmatter functions. Whether you're a Markdown padawan or a seasoned YAML-Frontmatter Jedi, this module is the perfect companion for your Charm framework journey.
Harness the power of Charm's built-in Symfony/Yaml package and Parsedown + Parsedown-Extra for HTML creation, bringing balance to the Markdown Force in your application.
Installation
Begin your quest by adding charm-markdown to your project via Composer:
composer require neoground/charm-markdown
Next, install charm-markdown in your application:
bob cm:i neoground/charm-markdown
Usage
Awaken the charm-markdown Force by initializing it with a file or a string:
$filepath = C::Storage()->getDataPath() . DS . 'demo.md'; $doc = C::Markdown()->fromFile($filepath);
or
$doc = C::Markdown()->fromString('# Hello World');
Unlock the secrets of the Markdown galaxy by accessing:
$doc->getMarkdownContent();to obtain the Markdown content part of the document$doc->getYaml();to retrieve the YAML frontmatter data as an array (or an empty array if not set)$doc->getHtml();to generate the HTML content, with Markdown Extra support and "id" tags added to each heading for easy anchoring$doc->getContentsList()to get an array of all headings as an easy table of contents
Experience the power of charm-markdown with direct access:
This returns an array with keys yaml (array) and markdown (string), containing each part of the document:
$arr = C::Markdown()->separateMarkdownFromYaml($content);
Extract the YAML array directly from the content string as an array:
C::Markdown()->getYaml($content);
Obtain the Markdown part directly from the content string as a string:
C::Markdown()->getMarkdownContent($content);
Format the Markdown part of the content string as HTML:
C::Markdown()->toHtml($content);
Usage in Views
In Twig views you can output a markdown string directly as HTML with:
<div id="content">{{ markdownToHtml(markdownString)|raw }}</div>
Embrace the charm-markdown Force and embark on an epic adventure of Markdown and YAML mastery in your Charm Framework application. May the Markdown be with you!
neoground/charm-markdown 适用场景与选型建议
neoground/charm-markdown 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 66 次下载、GitHub Stars 达 1, 最近一次更新时间为 2023 年 03 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 neoground/charm-markdown 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 neoground/charm-markdown 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 66
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 19
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-03-28