comparison media/js/markitup/sets/markdown/set.js @ 1:dbd703f7d63a

Initial import of sg101 stuff from private repository.
author gremmie
date Mon, 06 Apr 2009 02:43:12 +0000
parents
children 5b69d6e01fd4
comparison
equal deleted inserted replaced
0:900ba3c7b765 1:dbd703f7d63a
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 mySettings = {
14 previewParserPath: '/comments/markdown/',
15 previewParserVar: 'data',
16 previewInWindow: false,
17 previewAutoRefresh: false,
18 previewPosition: 'after',
19 onShiftEnter: {keepDefault:false, openWith:'\n\n'},
20 markupSet: [
21 {name:'First Level Heading', key:'1', placeHolder:'Your title here...', closeWith:function(markItUp) { return miu.markdownTitle(markItUp, '=') } },
22 {name:'Second Level Heading', key:'2', placeHolder:'Your title here...', closeWith:function(markItUp) { return miu.markdownTitle(markItUp, '-') } },
23 {name:'Heading 3', key:'3', openWith:'### ', placeHolder:'Your title here...' },
24 {name:'Heading 4', key:'4', openWith:'#### ', placeHolder:'Your title here...' },
25 {name:'Heading 5', key:'5', openWith:'##### ', placeHolder:'Your title here...' },
26 {name:'Heading 6', key:'6', openWith:'###### ', placeHolder:'Your title here...' },
27 {separator:'---------------' },
28 {name:'Bold', key:'B', openWith:'**', closeWith:'**'},
29 {name:'Italic', key:'I', openWith:'_', closeWith:'_'},
30 {separator:'---------------' },
31 {name:'Bulleted List', openWith:'- ' },
32 {name:'Numeric List', openWith:function(markItUp) {
33 return markItUp.line+'. ';
34 }},
35 {separator:'---------------' },
36 {name:'Picture', key:'P', replaceWith:'![[![Alternative text]!]]([![Url:!:http://]!] "[![Title]!]")'},
37 {name:'Link', key:'L', openWith:'[', closeWith:']([![Url:!:http://]!] "[![Title]!]")', placeHolder:'Your text to link here...' },
38 {separator:'---------------'},
39 {name:'Quotes', openWith:'> '},
40 {name:'Code Block / Code', openWith:'(!(\t|!|`)!)', closeWith:'(!(`)!)'},
41 {separator:'---------------'},
42 {name:'Smilies', className:'smilies', dropMenu: [
43 {name:'Argh', replaceWith:' :argh: ', className:'col1-1' },
44 {name:'Grin', replaceWith:' :-D ', className:'col1-2' },
45 {name:'Razz', replaceWith:' :-P ', className:'col1-3' },
46 {name:'Confused', replaceWith:' o_O ', className:'col1-4' },
47 {name:'Cool', replaceWith:' 8^) ', className:'col1-5' },
48 {name:'Cry', replaceWith:' :-( ', className:'col2-1' },
49 {name:'Dead', replaceWith:' x_x ', className:'col2-2' },
50 {name:'Embarrassed', replaceWith:' :-# ', className:'col2-3' },
51 {name:'LOL', replaceWith:' :lol: ', className:'col2-4' },
52 {name:'Mad', replaceWith:' X-( ', className:'col2-5' },
53 {name:'No', replaceWith:' :no: ', className:'col3-1' },
54 {name:'None', replaceWith:' :-| ', className:'col3-2' },
55 {name:'Shock', replaceWith:' :shock: ', className:'col3-3' },
56 {name:'Sigh', replaceWith:' :sigh: ', className:'col3-4' },
57 {name:'Smile', replaceWith:' :-) ', className:'col3-5' },
58 {name:'Uh-oh', replaceWith:' :uh-oh: ', className:'col4-1' },
59 {name:'Whatever', replaceWith:' :whatever: ', className:'col4-2' },
60 {name:'Wink', replaceWith:' ;-) ', className:'col4-3' },
61 {name:'Yes', replaceWith:' :yes: ', className:'col4-4' },
62 {name:'Sleep', replaceWith:' :sleep: ', className:'col4-5' }
63 ]
64 },
65 {separator:'---------------'},
66 {name:'Preview', call:'preview', className:"preview"}
67 ]
68 }
69
70 // mIu nameSpace to avoid conflict.
71 miu = {
72 markdownTitle: function(markItUp, char) {
73 heading = '';
74 n = $.trim(markItUp.selection||markItUp.placeHolder).length;
75 for(i = 0; i < n; i++) {
76 heading += char;
77 }
78 return '\n'+heading;
79 }
80 }