python - WMD Preview Doesn't Match Output -


I am using WMD in a Google App state from which the site administrator can update the site's pages and users Information is visible.

The preview function is working fine and I can see that text as I want to show it, but when I am in the Users section, marketing is being returned without formatting - I How can I fix this?

This is the code I use for

  {% block content-left%} {% if_admin%} and 
& Lt; Input type = "submit" name = "save" /> & Lt; / Form & gt; & Lt; Div class = "wmd-output" & gt; & Lt; / Div & gt; & Lt; Script type = "text / javascript" & gt; // To set programmatic option of WMD, define "wmd_options" // object with any setting / you want to override here are the default: wmd_options = {// format is sent to the server on the markdown Use "Markdown" to return the source Output: "Markdown", line wrapping length for // lists, blockcots, etc. LineLenth: 40, // toolbar button. Undo and re-engage automatically again. Button: "Bold Italic | Link Blockquote Code Image | Oll Ll Heading HR", / option, to automatically add WMD to textera first. // see apiExample.html for use. Auto start: true}; & Lt; / Script & gt; & Lt; Div class = "wmd-output" & gt; & Lt; / Div & gt; & Lt; Script type = "text / javascript" src = "/ static / wmd / wmd.js" & gt; & Lt; / Script & gt; {% Else%} {{page_content.html | MarkDown}} {% endif%}

Why is it happening because the dagengo form only & lt; representing the WMD editor Textarea & gt; Viewing the value of the tag This value is a real markdown, not the HTML presented, which you see in the preview.

There are several ways to fix this either on the client or server ...

  1. When the form is saved, the server using the Python Markdown Module

  2. When the form is submitted to the client, then Javascript will use the WMD and the LT for the actual HTML; Patria & gt; The value of the tag has changed

    Option # 1 is probably the easiest here to have some sample code ...

      Import markdown class MyModel (models.Model): text = models.TextField () def save (self, force_insert = False, force_update = False): if self .text: self.text = markdown.markdown (self.text) super (Mimodel, myself). Save (force_insert, force_update)  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -