wmd

How to combine WMD and prettify, like Stack Overflow?

有些话、适合烂在心里 提交于 2019-12-03 13:23:07
Prettify needs class="prettyprint" to be add to <pre> or <code> . How to let WMD do this? Take a look at the PageDown Markdown editor... AFAIK, WMD is dead, but PageDown is a fork based on the WMD source. It's an active project based on the work done in WMD. That takes care of the Markdown editor. To get syntax highlighting working you'll also need to download source from the Google-Code-Prettify project. Combine the demo.html, demo.css, prettify.js, prettify.css into the same folder. Modify the imports accordingly: <link rel="stylesheet" href="demo.css" /> <link rel="stylesheet" href=

Should i sanitize markdown?

一个人想着一个人 提交于 2019-12-03 12:32:07
问题 For my post entity i store both HTML and MARKDOWN in database (HTML is converted from MARKDOWN). HTML is for rendering on page and MARKDOWN for editing ability (with WMD). I sanitize HTML before storing to db. Question is: should i sanitize markdown too? or it is xss-safe if i only pass it to wmd-editor? 回答1: Markdown can contain arbitrary HTML; this is explicitly allowed. So you should sanitise it too, or at least sanitise the result of converting it to HTML, before sending to web clients. I

How do get WMD-Editor to post Markdown to the server and not HTML?

不想你离开。 提交于 2019-12-03 12:16:04
问题 It seems that WMD-Editor is posting HTML to the server instead of the markdown. How can i get it to send the Markdown? 回答1: In the master branch of the SO version, the interesting line is line 2341: Attacklab.wmd_defaults = {version:1, output:"HTML", lineLength:40, delayLoad:false}; Change this to ask for markdown instead: Attacklab.wmd_defaults = {version:1, output:"markdown", lineLength:40, delayLoad:false}; .. and you'll get the Markdown instead. 回答2: In my version (mooWMD) you have to

Should i sanitize markdown?

半城伤御伤魂 提交于 2019-12-03 03:00:26
For my post entity i store both HTML and MARKDOWN in database (HTML is converted from MARKDOWN). HTML is for rendering on page and MARKDOWN for editing ability (with WMD). I sanitize HTML before storing to db. Question is: should i sanitize markdown too? or it is xss-safe if i only pass it to wmd-editor? Markdown can contain arbitrary HTML; this is explicitly allowed. So you should sanitise it too, or at least sanitise the result of converting it to HTML, before sending to web clients. I remember that one of the exploits possible with SO in the early days is that you could put JS content in

Why do I need Markdown?

懵懂的女人 提交于 2019-12-03 02:41:25
Why do I need a Markdown with a front edit editor like WMD ? What does the markdown do to the content that’s sent from the WMD editor? How does Markdown store the content in the backend? Is it the same way like *bold* or in some other format? Why can’t I just do an html encode ? Sorry if I sounded very naïve. It's probably helpful to take a step back and ask some of the larger questions. The issue Markdown is trying to solve is that of rich editing in the browser. Consider this: At some point, for any piece of software to enable rich text it has to describe the richness in a some manner,

How do get WMD-Editor to post Markdown to the server and not HTML?

我们两清 提交于 2019-12-03 02:41:07
It seems that WMD-Editor is posting HTML to the server instead of the markdown. How can i get it to send the Markdown? In the master branch of the SO version, the interesting line is line 2341: Attacklab.wmd_defaults = {version:1, output:"HTML", lineLength:40, delayLoad:false}; Change this to ask for markdown instead: Attacklab.wmd_defaults = {version:1, output:"markdown", lineLength:40, delayLoad:false}; .. and you'll get the Markdown instead. In my version (mooWMD) you have to change the value at line 1343 from 'html' to 'markdown'. I believe it is the same for the SO version (look for the

running showdown.js serverside to conver Markdown to HTML (in PHP)

廉价感情. 提交于 2019-12-01 11:56:20
I am trying to implement WMD onto my website and was wondering how would I go about running showdown.js server side to convert markdown to HTML? (in order to store both in the DB) I am using PHP...any tips would be helpful (never ran any sort of js from php before) Thanks, Andrew You could use PHP Markdown , which is a port of the Markdown program written by John Gruber. Here is a example of how to use PHP Markdown with your code. include_once "markdown.php"; $my_html = Markdown($my_text); If you're going to run a markdown converter, why run the javascript port? Isn't that a bit backwards?

WMD in Django Admin?

ぃ、小莉子 提交于 2019-11-30 07:02:56
I know how to use WMD and other such javascript editors in regular django forms using widget=. However, how do I use WMD for text fields in the Django admin? On top of that, how do I use it for the content field on contrib.flatpages in the admin? Also, I think I might like to use the StackOverflow fork of WMD, so I would like any special instructions for that, if necessary. I know how to use the markdown filter in the templates, so that part is ok. I just need to get the editor to show up and work in the admin interface. I gave up on trying to use WMD. Instead, I used Markitup! As of the time

How do you store the markdown using WMD in ASP.NET?

橙三吉。 提交于 2019-11-28 21:39:25
I have implemented the WMD control that Stack Overflow uses into a project of mine, it almost works like a charm, but when I save the changes to the database it is saving the HTML version and not the Markdown version. So where I have this in my text box: **boldtext** It is really saving this: <b>boldtext</b> How do I make it save the Markdown version? Clinton N. Dreisbach Before you include wmd.js , or whatever you've named the WMD editor JavaScript code locally, add one line of JavaScript code: wmd_options = {"output": "Markdown"}; This will force the output of the editor to Markdown. Ryan

Which Stack Overflow-style Markdown (WMD) JavaScript editor should I use?

北城余情 提交于 2019-11-28 15:01:10
Background I'm working on an application which requires user-entered content, and I've decided to use a Stack Overflow-style Markdown editor. After researching this topic for the last few days, I realize there are numerous forks of the base WMD editor, some with a few basic enhancements and some with serious differences from the Stack Overflow one. Since this will be the heart of the application, I'd like to start with the best code base I can. I'd be happy if anyone can recommend which one of the many solutions out there best fits my needs. Below are requirements, plus what I've managed to