natedrake/markdown

PHP markdown 转换器

1.3.1 2017-04-02 22:42 UTC

This package is not auto-updated.

Last update: 2024-09-29 01:22:49 UTC


README

Build Status Latest Stable Version Total Downloads Latest Unstable Version License composer.lock

Monthly Downloads Daily Downloads

PHP Markdown 转换器

  1. 标题
  2. 斜体
  3. 粗体
  4. 删除线
  5. 链接
  6. 图片
  7. 列表
  8. 引用块
  9. 表格

Markdown 是一个 PHP 库,用于将 markdown 转换为标记。它是一个用于在网页上创建文档的有用工具。例如,如果您的网站包含博客、维基页面,或者允许用户进行任何编辑,您可以通过 markdown 允许他们使用 markdown 来格式化文档。

标题

# <h1>

## <h2>

### <h3>

#### <h4>

##### <h5>

## 这是二级标题 将生成以下标记 <h2>这是二级标题</h2>

斜体

__text__

将文本包裹在 __ 中以使其斜体

__这是斜体文本__ 将生成以下标记 <em>这是斜体文本</em>

粗体

**text**

将文本包裹在 ** 中以使其粗体

**这是粗体文本** 将生成以下标记 <strong>这是粗体文本</strong>

链接

[Text](Hyperlink)

通过在方括号中插入链接文本,然后在其后插入正常括号中的超链接来创建链接

Google

[Google](https://google.ie) 将生成以下标记 <a href="https://gooogle.ie" target="_blank">Google</a>

图片

![Alt Text](link to image)

通过在方括号中插入替代文本,然后在其后插入正常括号中的图像链接来创建图像

Git Logo

![Git Logo](https://assets-cdn.github.com/images/modules/logos_page/GitHub-Logo.png) 将生成以下标记 <img src="https://assets-cdn.github.com/images/modules/logos_page/GitHub-Mark.png" alt="Git Logo" />

代码

通过将元素包裹在 ```var x;``` 中来创建行内代码元素

```var x;```

产生以下标记

<code>var x;</code>

如果需要跨多行,请使用四个反引号而不是三个,并确保在反引号内部有一个换行符

列表

无序列表

List
 - item one
 - item two
 - item three

将生成以下标记

<ul>
    <li>item one</li>
    <li>item two</li>
    <li>item three</li>
</ul>

有序列表

List
 1. item one
 2. item two
 3. item three

将生成以下标记

<ol>
    <li>item one</li>
    <li>item two</li>
    <li>item three</li>
</ol>

引用块

> this is a block quote

将生成以下标记

<blockquote> this is a block quote</blockquote>

表格

现在可以通过使用横线字符创建表格。使用 | 字符来绘制表格及其列

|Heading One|Heading Two|Heading Three|
|Row1Col1|Row1Col2|Row1Col2|
|Row2Col1|Row2Col2|Row2Col2|
|Row3Col1|Row3Col2|Row3Col2|

生成类似以下 HTML 表格

<table border="border">
    <thead>
        <th>heading one</th>
        <th>heading two</th>
        <th>heading three</th>
    </thead>
    <tbody>
        <tr>
            <td>row1Col1</td><td>row1Col2</td><td>row1Col3</td>
        </tr>
        <tr>
            <td>row2Col1</td><td>row2Col2</td><td>row2Col3</td>
        </tr>
        <tr>
            <td>row3Col1</td><td>row3 col2</td><td>row3Col3</td>
         </tr>
    </tbody>
</table>