sonata_formatter_js_set_2.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // -------------------------------------------------------------------
  2. // markItUp!
  3. // -------------------------------------------------------------------
  4. // Copyright (C) 2008 Jay Salvat
  5. // http://markitup.jaysalvat.com/
  6. // -------------------------------------------------------------------
  7. // MarkDown tags example
  8. // http://en.wikipedia.org/wiki/Markdown
  9. // http://daringfireball.net/projects/markdown/
  10. // -------------------------------------------------------------------
  11. // Feel free to add more tags
  12. // -------------------------------------------------------------------
  13. var markitup_sonataMarkdownSettings = {
  14. previewParserPath: '',
  15. onShiftEnter: {keepDefault:false, openWith:'\n\n'},
  16. markupSet: [
  17. {name:'First Level Heading', key:'1', placeHolder:'Your title here...', closeWith:function(markItUp) { return miu.markdownTitle(markItUp, '=') } },
  18. {name:'Second Level Heading', key:'2', placeHolder:'Your title here...', closeWith:function(markItUp) { return miu.markdownTitle(markItUp, '-') } },
  19. {name:'Heading 3', key:'3', openWith:'### ', placeHolder:'Your title here...' },
  20. {name:'Heading 4', key:'4', openWith:'#### ', placeHolder:'Your title here...' },
  21. {name:'Heading 5', key:'5', openWith:'##### ', placeHolder:'Your title here...' },
  22. {name:'Heading 6', key:'6', openWith:'###### ', placeHolder:'Your title here...' },
  23. {separator:'---------------' },
  24. {name:'Bold', key:'B', openWith:'**', closeWith:'**'},
  25. {name:'Italic', key:'I', openWith:'_', closeWith:'_'},
  26. {separator:'---------------' },
  27. {name:'Bulleted List', openWith:'- ' },
  28. {name:'Numeric List', openWith:function(markItUp) {
  29. return markItUp.line+'. ';
  30. }},
  31. {separator:'---------------' },
  32. {name:'Picture', key:'P', replaceWith:'![[![Alternative text]!]]([![Url:!:http://]!] "[![Title]!]")'},
  33. {name:'Link', key:'L', openWith:'[', closeWith:']([![Url:!:http://]!] "[![Title]!]")', placeHolder:'Your text to link here...' },
  34. {separator:'---------------'},
  35. {name:'Quotes', openWith:'> '},
  36. {name:'Code Block / Code', openWith:'(!(\t|!|`)!)', closeWith:'(!(`)!)'},
  37. // {separator:'---------------'},
  38. // {name:'Preview', call:'preview', className:"preview"}
  39. ]
  40. }
  41. // mIu nameSpace to avoid conflict.
  42. miu = {
  43. markdownTitle: function(markItUp, ch) {
  44. heading = '';
  45. n = $.trim(markItUp.selection||markItUp.placeHolder).length;
  46. for(i = 0; i < n; i++) {
  47. heading += ch;
  48. }
  49. return '\n'+heading;
  50. }
  51. }