annotate media/js/markitup/sets/markdown/set.js @ 53:f882ac8ce255

Fix xhtml error in POTD template.
author Brian Neal <bgneal@gmail.com>
date Sun, 21 Jun 2009 22:41:58 +0000
parents dbd703f7d63a
children 5b69d6e01fd4
rev   line source
gremmie@1 1 // -------------------------------------------------------------------
gremmie@1 2 // markItUp!
gremmie@1 3 // -------------------------------------------------------------------
gremmie@1 4 // Copyright (C) 2008 Jay Salvat
gremmie@1 5 // http://markitup.jaysalvat.com/
gremmie@1 6 // -------------------------------------------------------------------
gremmie@1 7 // MarkDown tags example
gremmie@1 8 // http://en.wikipedia.org/wiki/Markdown
gremmie@1 9 // http://daringfireball.net/projects/markdown/
gremmie@1 10 // -------------------------------------------------------------------
gremmie@1 11 // Feel free to add more tags
gremmie@1 12 // -------------------------------------------------------------------
gremmie@1 13 mySettings = {
gremmie@1 14 previewParserPath: '/comments/markdown/',
gremmie@1 15 previewParserVar: 'data',
gremmie@1 16 previewInWindow: false,
gremmie@1 17 previewAutoRefresh: false,
gremmie@1 18 previewPosition: 'after',
gremmie@1 19 onShiftEnter: {keepDefault:false, openWith:'\n\n'},
gremmie@1 20 markupSet: [
gremmie@1 21 {name:'First Level Heading', key:'1', placeHolder:'Your title here...', closeWith:function(markItUp) { return miu.markdownTitle(markItUp, '=') } },
gremmie@1 22 {name:'Second Level Heading', key:'2', placeHolder:'Your title here...', closeWith:function(markItUp) { return miu.markdownTitle(markItUp, '-') } },
gremmie@1 23 {name:'Heading 3', key:'3', openWith:'### ', placeHolder:'Your title here...' },
gremmie@1 24 {name:'Heading 4', key:'4', openWith:'#### ', placeHolder:'Your title here...' },
gremmie@1 25 {name:'Heading 5', key:'5', openWith:'##### ', placeHolder:'Your title here...' },
gremmie@1 26 {name:'Heading 6', key:'6', openWith:'###### ', placeHolder:'Your title here...' },
gremmie@1 27 {separator:'---------------' },
gremmie@1 28 {name:'Bold', key:'B', openWith:'**', closeWith:'**'},
gremmie@1 29 {name:'Italic', key:'I', openWith:'_', closeWith:'_'},
gremmie@1 30 {separator:'---------------' },
gremmie@1 31 {name:'Bulleted List', openWith:'- ' },
gremmie@1 32 {name:'Numeric List', openWith:function(markItUp) {
gremmie@1 33 return markItUp.line+'. ';
gremmie@1 34 }},
gremmie@1 35 {separator:'---------------' },
gremmie@1 36 {name:'Picture', key:'P', replaceWith:'![[![Alternative text]!]]([![Url:!:http://]!] "[![Title]!]")'},
gremmie@1 37 {name:'Link', key:'L', openWith:'[', closeWith:']([![Url:!:http://]!] "[![Title]!]")', placeHolder:'Your text to link here...' },
gremmie@1 38 {separator:'---------------'},
gremmie@1 39 {name:'Quotes', openWith:'> '},
gremmie@1 40 {name:'Code Block / Code', openWith:'(!(\t|!|`)!)', closeWith:'(!(`)!)'},
gremmie@1 41 {separator:'---------------'},
gremmie@1 42 {name:'Smilies', className:'smilies', dropMenu: [
gremmie@1 43 {name:'Argh', replaceWith:' :argh: ', className:'col1-1' },
gremmie@1 44 {name:'Grin', replaceWith:' :-D ', className:'col1-2' },
gremmie@1 45 {name:'Razz', replaceWith:' :-P ', className:'col1-3' },
gremmie@1 46 {name:'Confused', replaceWith:' o_O ', className:'col1-4' },
gremmie@1 47 {name:'Cool', replaceWith:' 8^) ', className:'col1-5' },
gremmie@1 48 {name:'Cry', replaceWith:' :-( ', className:'col2-1' },
gremmie@1 49 {name:'Dead', replaceWith:' x_x ', className:'col2-2' },
gremmie@1 50 {name:'Embarrassed', replaceWith:' :-# ', className:'col2-3' },
gremmie@1 51 {name:'LOL', replaceWith:' :lol: ', className:'col2-4' },
gremmie@1 52 {name:'Mad', replaceWith:' X-( ', className:'col2-5' },
gremmie@1 53 {name:'No', replaceWith:' :no: ', className:'col3-1' },
gremmie@1 54 {name:'None', replaceWith:' :-| ', className:'col3-2' },
gremmie@1 55 {name:'Shock', replaceWith:' :shock: ', className:'col3-3' },
gremmie@1 56 {name:'Sigh', replaceWith:' :sigh: ', className:'col3-4' },
gremmie@1 57 {name:'Smile', replaceWith:' :-) ', className:'col3-5' },
gremmie@1 58 {name:'Uh-oh', replaceWith:' :uh-oh: ', className:'col4-1' },
gremmie@1 59 {name:'Whatever', replaceWith:' :whatever: ', className:'col4-2' },
gremmie@1 60 {name:'Wink', replaceWith:' ;-) ', className:'col4-3' },
gremmie@1 61 {name:'Yes', replaceWith:' :yes: ', className:'col4-4' },
gremmie@1 62 {name:'Sleep', replaceWith:' :sleep: ', className:'col4-5' }
gremmie@1 63 ]
gremmie@1 64 },
gremmie@1 65 {separator:'---------------'},
gremmie@1 66 {name:'Preview', call:'preview', className:"preview"}
gremmie@1 67 ]
gremmie@1 68 }
gremmie@1 69
gremmie@1 70 // mIu nameSpace to avoid conflict.
gremmie@1 71 miu = {
gremmie@1 72 markdownTitle: function(markItUp, char) {
gremmie@1 73 heading = '';
gremmie@1 74 n = $.trim(markItUp.selection||markItUp.placeHolder).length;
gremmie@1 75 for(i = 0; i < n; i++) {
gremmie@1 76 heading += char;
gremmie@1 77 }
gremmie@1 78 return '\n'+heading;
gremmie@1 79 }
gremmie@1 80 }