Running showdown.js serveride to convert Markdown to HTML (in PHP)

I am trying to embed WMD into my website and wondered how I will run the showdown.js server page to convert markdown to HTML? (to save both in the database)

I am using PHP ... any hints would be helpful (have never run any js from php before)

Thanks Andrew

+1
source share
3 answers

You can use PHP Markdown , which is a Markdown port written by John Gruber.

Here is an example of using PHP Markdown with your code.

include_once "markdown.php"; $my_html = Markdown($my_text); 
+4
source

If you are going to start the markdown converter, why start the javascript port? Isn't that a little back?

Markdown was originally designed to work on the server side, an autopsy is a port that allows you to convert to javascript.

This is where you start .

+2
source

WMD processes your markup on the client side. It allows the user to view an extended text version of his input before sending.

Once the user is happy, they will send their login to the server using the form.

At this point, you will use your PHP script to accept the input and misinform it. You will need to remove all possible XSS exploits and any HTML tags that you do not want to store in your database.

0
source

Source: https://habr.com/ru/post/1302656/


All Articles