i m using wmd markdown editor in my project and i have a problem with code tags:
if i enter a code snippet , markdown does not convert to html correctly it converts in "<p>
" tags but if i enter some text else first and then code snippet it converts correctly in "<code>
" tags
is this a bug of wmd markdown editor? and how can i solve this problem?
wmd markdown code problem
315 views Asked by fealin At
2
There are 2 answers
0
On
With Mr. T. Stone answer. I have done in WMD that i used, to remove
<p> ..article.. </p>
to be ..article..
And here the WMD.js code :(line : 910 )
if (converter) {
text = converter.makeHtml(text);
//new code here
text= text.replace(/^<p>/g, '').replace(/<\/p>$/g, '');
}
i wrote this in answer because i am very glad it solve my problem in a week. thankyou.
I was actually working on this for my fixed version of WMD edit. Using regex you can quickly lop off the leading and trailing
<p>
tags which are most notably the causers of a lot of problems:To enforce this in wmd..
(I'm asuming you're using the SO fork of wmd editor) Find this part of the code and change it as follows:
Untested, but you should get the idea.