开发者

How can I get simple plain text from the WMD editor?

I'm able to get Markdown and HTML formated text from the WMD editor. In my requirement I also need to get plain text from the WMD Editor. I would like to explain it with a simple example.

In Stack Overflow we will see Markdown text while typing a description in the WMD editor. In the preview we are able to see the <b>formatted text. In the Question Page, without this Markdown and formatted text we are able to see the question description in two lines.

I need to achieve same kind of functionality. What do I ne开发者_C百科ed to do?


WMD (or at least wmd-new, since WMD seems abandoned) uses jQuery, so the easiest way to get the plain text output is:

$('#wmd-preview').text()

assuming you're using the standard div id for the preview. This even works as written in Stack Overflow.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜