-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Usage
hkdobrev edited this page Sep 21, 2014
·
20 revisions
Basic usage:
echo Parsedown::instance()->text('Hello _Parsedown_!'); # would print <p>Hello <em>Parsedown</em>!</p>
This would also work:
$Parsedown = new Parsedown();
echo $Parsedown->text('Hello _Parsedown_!'); # would print <p>Hello <em>Parsedown</em>!</p>
Parsing only inline elements (instead of both block-level and inline elements):
echo Parsedown::instance()->line('Hello _Parsedown_!'); # would print Hello <em>Parsedown</em>!
Using options:
echo Parsedown::instance()
->setBreaksEnabled(true) # enables automatic line breaks.
->text("1st line \n 2nd line"); # would print <p>1st line <br /> 2nd line</p>
echo Parsedown::instance()
->setNoMarkup(true) # Disallows (escapes) HTML in Markdown
->text("<div><strong>*Some text*</strong></div>");
# Output:
# <p><div><strong><em>Some text</em><s;/strong></div></p>