The next generation of the Teknik Services. Written in ASP.NET.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MarkdownDeep Quick Reference.txt 2.3KB

  1. MarkdownDeep Quick Reference
  2. ============================
  3. Setting up the Client Side Editor
  4. ---------------------------------
  5. The following assumes you've installed the full edition MarkdownDeep using NuGet and explains how to setup
  6. a client side editor with toolbar, resize bar, real-time preview and syntax reference help.
  7. 1. In either your master view page, or in the view containing the editor ensure the following references are in place:
  8. <link rel="stylesheet" type="text/css" href="/Scripts/mdd_styles.css" />
  9. <script type="text/javascript" src="/Scripts/jQuery-1.4.1.min.js"></script>
  10. <script type="text/javascript" src="/Scripts/MarkdownDeepLib.min.js"></script>
  11. 2. Insert the following markup at the location you want the editor to appear:
  12. <div class="mdd_toolbar"></div>
  13. <%=Html.TextArea("content", new { @class="mdd_editor" }) %>
  14. <div class="mdd_resizer"></div>
  15. <div class="mdd_preview"></div>
  16. Note, the mdd_toolbar, mdd_resizer and mdd_preview divs are all optional. If ommitted, the jQuery plugin will
  17. create them however this may cause the page to appear to "jump" as it loads. By using the above divs and the
  18. associated mdd_styles.css stylesheet, the correct sizing can be in-place immediately, eliminating these jumps.
  19. 3. Use the jQuery plugin to convert the textarea into a Markdown editor. For more options, see below.
  20. $(function () {
  21. $("textarea.mdd_editor").MarkdownDeep({
  22. help_location:"/Scripts/mdd_help.htm",
  23. ExtraMode: true
  24. });
  25. })
  26. See <> for more information on configuring the editor.
  27. Server Side Translation
  28. -----------------------
  29. The above steps allow you to create forms where the user can enter and preview Markdown content. This section
  30. explains how to perform the equivalent translation of the entered content server side.
  31. 1. When you installed MarkdownDeep to your project with NuGet, a reference to MarkdownDeep.dll would already have
  32. been created.
  33. 2. To translate Markdown, instantiate an instance of the MarkdownDeep class and call it's Translate method to
  34. do the translation:
  35. // Instantiate
  36. var md=new MarkdownDeep.Markdown();
  37. // Set options
  38. md.ExtraMode=true;
  39. // Translate
  40. var html=md.Transform(plaintext);
  41. See <> for other methods and properties.