I have an MVC3 site that should handle user messages. I'm trying to use MarkItUp to edit text because I like its full-featured, easy-to-configure, functionality. However, I use two markup libraries for conversion: Pagedown (client side) and MarkdownSharp (server side).
Here are the scripts in my edit view:
<script type="text/javascript" src="@Url.Content("~/scripts/jquery.markitup.js")"></script> <script type="text/javascript" src="@Url.Content("~/scripts/jquery.markitup.settings.js")"></script> <script type="text/javascript" src="@Url.Content("~/Scripts/Markdown.Converter.js")"></script> <script type="text/javascript" src="@Url.Content("~/Scripts/Markdown.Sanitizer.js")"></script> <script type="text/javascript" > $(document).ready(function () { var converter = new Markdown.Converter(); $('.editor').markItUp(markdownSettings); $('.markdown').live('keyup', function () { var md = $('#comment-editor').val(); var html = converter.makeHtml(md); $('#preview').html(html); }); $('.markdown').live('click', function () { var md = $('#comment-editor').val(); var html = converter.makeHtml(md); $('#preview').html(html); }); }); </script>
And HTML:
@Html.TextArea("html", "enter your text here", new { id = "comment-editor", @class = "editor" }) <div id="preview" class="markdown"></div>
So far so good. The problem / my question is ... when I run this and start typing, all groovy is that the preview will convert correctly when I type , but italics don't work. I use notation notation or one *, type text or click in the editor ... it is not italicized.
Is there a problem between the Pagedown converter and the MarkItUp editor? Or am I missing nothing?
For clarification here, what a preview of a DIV (Firebug) looks like:
<div id="preview" class="markdown"> <p>stuff you <em>dont</em> see <em>every</em> day.</p> </div>
Note that "dont" is marked with _ and "each" with * .
source share