WMD - How to Get Generated \ Markdown HTML Code

Well, I got WMD, but I can’t find out how to get the generated HTML \ Markdown code .... I want to send it to the DB ... that's why I use PHP ....

<script src='wmd.js'></script> <form name="formname" method='POST'> <textarea id="myTextarea" style="width: 500px; height: 200px;"> *This* example sets WMD options programmatically. </textarea> <input type="submit" name="sub" value="submit"> </form> <!--Preview Can Be Seen Here--> <div class="wmd-preview" id="wmd"></div> <?php if( isset( $_POST['sub'] ) ) { $generated_HTML = "How to get it here"; } ?> 

Now can someone tell me how to get the generated HTML ...

0
html php wmd-editor
source share
2 answers

WMD Editor is just a client-side text editor that supports text input with a formatted fingerprint. To convert markdowns to HTML, you need a markup parser.

A quick google tells me at least one available: http://michelf.com/projects/php-markdown/

+2
source share

get these wmd.js and markdown.php files

and use the following code

 <script src="wmd.js"></script> <script type="text/javascript"> wmd_options = {output: "HTML",lineLength: 40,buttons: "bold italic | link image | ol ul heading hr",autostart: true}; </script> <form name="formname" method="post" action=""> <textarea id="myTextarea" style="width: 500px; height: 200px;" name="TA"></textarea> <br><input type="submit" name="KILL" value="Submit"> </form> <?php if( isset( $_POST['kil'] ) ) { $my_text = $_POST['tr']; include ('markdown.php'); $my_html = Markdown($my_text); echo $my_html; //$send $myhtml to database or do something with } ?> 
0
source share

All Articles