Salah satu parser MarkDown terbaik di PHP tentu saja Parsedown.Tentu saja, ada juga Tekstil, tetapi terlalu menakutkan, tetapi untuk perubahan, cobalah juga.Dalam dokumen ini, kami akan menganalisis seluruh sintaks Parsedown.Kami mengambil contoh dari situs web resmi dan menempatkannya sehingga nyaman bagi Anda untuk menemukan contoh yang Anda butuhkan dengan cepat di satu halaman.
Jadi, lembar contekan Parsedown.
| header 1 | header 2 |
| -------- | -------- |
| cell 1.1 | cell 1.2 |
| cell 2.1 | cell 2.2 |
| header 1 | header 2 | header 2 |
| :------- | :------: | -------: |
| cell 1.1 | cell 1.2 | cell 1.3 |
| cell 2.1 | cell 2.2 | cell 2.3 |
# h1
## h2
### h3
#### h4
##### h5
###### h6
####### not a heading
# closed h1 #
#
<http://example.com>
<div>_content_</div>
paragraph
<div>
<div class="inner">
_content_
</div>
</div>
<style type="text/css">
p {color: #789;}
</style>
<div>
<a href="/">home</a></div>
<?php
$message = 'Hello World!';
echo $message;
---
> not a quote
- not a list item
[not a reference]: http://foo.com
a `code span`
`this is also a codespan` trailing text
`and look at this one!`
single backtick in a code span: `` ` ``
backtick-delimited string in a code span: `` `foo` ``
`sth `` sth`
> header
> ------
>
> paragraph
>
> - li
>
> ---
>
> paragraph
_`code`_ __`code`__
*`code`**`code`**`code`*
- paragraph
paragraph
- paragraph
> quote
- li
- li
- li
- li
- li
- li
___em strong___
___em strong_ strong__
__strong _em strong___
__strong _em strong_ strong__
***em strong***
***em strong* strong**
**strong *em strong***
**strong *em strong* strong**
my email is <me@example.com>
_underscore_, *asterisk*, _one two_, *three four*, _a_, *b*
**strong** and *em* and **strong** and *em*
_line
line
line_
this_is_not_an_emphasis
an empty emphasis __ ** is not an emphasis
*mixed **double and* single asterisk** spans
escaped \*emphasis\*.
`escaped \*emphasis\* in a code span`
escaped \*emphasis\* in a code block
\\ \` \* \_ \{ \} \[ \] \( \) \> \# \+ \- \. \!
_one\_two_ __one\_two__
*one\*two* **one\*two**
```
<?php
$message = 'fenced code block';
echo $message;
```
~~~
tilde
~~~
```php
echo 'language identifier';
```
```c#
echo 'language identifier with non words';
```
```html+php
<?php
echo "Hello World";
?>
<a href="http://auraphp.com" >Aura Project</a>
```
```php some-class
<?php
echo "Hello World";
```
---
- - -
- - -
***
___
<!-- single line -->
paragraph
<!--
multiline -->
paragraph
& © {
![Markdown Logo][image]
[image]: /md.png
![missing reference]


an [implicit] reference link
[implicit]: http://example.com
an [implicit][] reference link with an empty link definition
an [implicit][] reference link followed by [another][]
[another]: http://cnn.com
an [explicit][example] reference link with a title
[example]: http://example.com "Example"
[link](http://example.com)
[link](/url-(parentheses)) with parentheses in URL
([link](/index.php)) in parentheses
[`link`](http://example.com)
[](http://example.com)
[ and text](http://example.com)
[ and text](http://example.com)
[single quotes](http://example.com 'Title')
[double quotes](http://example.com "Title")
[single quotes blank](http://example.com '')
[double quotes blank](http://example.com "")
[space](http://example.com "2 Words")
[parentheses](http://example.com/url-(parentheses) "Title")
[single quotes](http://example.com 'Example') and [double quotes](http://example.com "Example")
> quote
the rest of it
> another paragraph
the rest of it
- li
the rest of it
line
line
- li
line
line
1. One
First body copy
2. Two
Last body copy
<div>
_parent_
<div>
_child_
</div>
<pre>
_adopted child_
</pre>
</div>
_outside_
1. one
2. two
repeating numbers:
1. one
1. two
large numbers:
123. one
paragraph
- li
- li
paragraph
* li
* li
[double quotes] and [single quotes] and [parentheses]
[double quotes]: http://example.com "example title"
[single quotes]: http://example.com 'example title'
[parentheses]: http://example.com (example title)
[invalid title]: http://example.com example title
<hr>
paragraph
<hr/>
paragraph
<hr />
paragraph
<hr class="foo" id="bar" />
paragraph
<hr class="foo" id="bar"/>
paragraph
<hr class="foo" id="bar" >
paragraph
- li
- li
- li
h1
==
h2
--
single character
-
not a header
------------
> quote
indented:
> quote
no space after `>`:
>quote
header 1 | header 2
-------- | --------
cell 1.1 | cell 1.2
cell 2.1 | cell 2.2
---
header 1 | header 2
:------- | --------
cell 1.1 | cell 1.2
cell 2.1 | cell 2.2
an <b>important</b> <a href=''>link</a>
broken<br/>
line
<b>inline tag</b> at the beginning
<span>http://example.com</span>
- li
- li
- li
<div>
line 1
line 2
line 3
line 4
</div>
- li
- li
---
- li
- indented li
AT&T has an ampersand in their name
this & that
4 < 5 and 6 > 5
<http://example.com/autolink?a=1&b=2>
[inline link](/script?a=1&b=2)
[reference link][1]
[1]: http://example.com/?a=1&b=2
~~strikethrough~~
here's ~~one~~ followed by ~~another one~~
~~ this ~~ is not one neither is ~this~
*em **strong em***
***strong em** em*
*em **strong em** em*
_em __strong em___
___strong em__ em_
_em __strong em__ em_
<?php
$message = 'Hello World!';
echo $message;
echo "following a blank line";
| _header_ 1 | header 2 |
| ------------ | ------------ |
| _cell_ 1.1 | ~~cell~~ 1.2 |
| `|` 2.1 | \| 2.2 |
| `\|` 2.1 | [link](/) |
[reference link][1]
[1]: http://example.com
[one][website] with a semantic name
[website]: http://example.com
[one][404] with no definition
[multiline
one][website] defined on 2 lines
[one][Label] with a mixed case label and an upper case definition
[LABEL]: http://example.com
[one]
[1] with the a label on the next line
[`link`][website]
- li
- li
mixed markers:
* li
+ li
- li
| header 1 | header 2 |
| ------------- | ----------- |
| cell 1.1 | cell 1.2 |
| cell 2.1 | cell 2.2 |
an autolink http://example.com
inside of brackets [http://example.com], inside of braces {http://example.com}, inside of parentheses (http://example.com)
trailing slash http://example.com/ and http://example.com/path/
code
[xss](https://www.example.com")

[xss](https://www.example.com')



[xss](javascript:alert(1))
[xss]( javascript:alert(1))
[xss](javascript://alert(1))
[xss](javascript:alert(1))
)
)
)
)
[xss](data:text/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==)
[xss]( data:text/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==)
[xss](data://text/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==)
[xss](data:text/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==)




<script>alert(1)</script>
<script>
alert(1)
</script>
<script>
alert(1)
</script>
Parsedown seperti yang ditunjukkan di atas memiliki banyak nuansa, tetapi mencakup semua fitur dasar MarkDown.
Menghubungkan Parsedown di PHP sangat sederhana, kita tidak memerlukan komposer, cukup satu file Parsedown.php saja sudah cukup
$Parsedown = new Parsedown();
echo $Parsedown->text('Hello _Parsedown_!');