承接 jidaikobo/php-markdown 相关项目开发

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

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

jidaikobo/php-markdown

最新稳定版本:v1.0.7

Composer 安装命令:

composer require jidaikobo/php-markdown

包简介

A few additions to michelf/php-markdown

关键字:

README 文档

README

MIT

jidaikobo/php-markdown

A few additions to the popular michelf/php-markdown. This library provides custom enhancements and overrides to the original Markdown parser, tailored for specific needs.

Installation

Install via Composer:

composer require jidaikobo/php-markdown

Usage

Here's how you can use the library in your project:

require 'vendor/autoload.php';

use Jidaikobo\MarkdownExtra;

$table = "
## heading

| Header 1 | Header 2 |
|----------|----------|
| Row 1   :| Cell 1   |
| Row 2   :| Cell 2   |
|:capt.


| scope row:| scope col |
|-----------|-----------|
| Row 1    :| Row2      |
";

$html = MarkdownExtra::defaultTransform($table);

echo $html;

Custom Enhancements

This library adds specific parsing behaviors:

1. Row Headers in Tables

By adding a colon (:) at the end of a cell, you can mark it as a row header (th):

| Name     | Age | City       |
|----------|-----|------------|
| Alice   :| 30  | New York   |
| Bob     :| 25  | San Francisco |

You can change the scope of th to row by adding a colon (:) to the end of the header cell:

| Values  :| Age | City       |
|----------|-----|------------|
| Alice   :| 30  | New York   |
| Bob     :| 25  | San Francisco |

2. Table Captions

If the last row of the table starts with a colon (:), it will be treated as a caption:

| Name    | Age | City          |
|---------|-----|---------------|
| Alice   | 30  | New York      |
| Bob     | 25  | San Francisco |
|: This is a caption for the table.

3. Add file type and size to Link text

When the link destination is a file, the file type and file size are added to the link string. Sets the relationship between a URL and a path on the server.

MarkdownExtra::setTargetUrl('https://example.com');
MarkdownExtra::setReplacePath('/var/www/public_html/example.com');
[link text](https://example.com/files/example.zip)
<a href="https://example.com/files/example.zip">link text (zip, 1.2MB)</a>

4. figcaption

The image and em notation are arranged side by side without line breaks.

![](https://example.com/files/example.jpg)
*caption*
<figure>
![](https://example.com/files/example.jpg)
<figcaption>caption</figcaption>
</figure>

Requirements

  • PHP 7.4 or higher

License

This project is licensed under the MIT License, see the LICENSE file for details

Author

Link

Acknowledgements

This library builds upon the work of Michel Fortin and his excellent michelf/php-markdown. Learn more at the official repository.

统计信息

  • 总下载量: 134
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-12-28