diff options
author | Alvin Li <liweitianux@gmail.com> | 2013-08-13 14:13:24 +0800 |
---|---|---|
committer | Alvin Li <liweitianux@gmail.com> | 2013-08-13 14:13:24 +0800 |
commit | 9636d4a6767f49384d5c386bc3f1142c88b90613 (patch) | |
tree | 3a70f6d9e4be1791d36c87cc7cbfd1d5aa2b39dd /97suifangqa/staticfiles/markitup/sets/markdown/set.js | |
parent | 9383d9a8a5988d071766c3d08a5c946e9c5b02ae (diff) | |
download | 97dev-9636d4a6767f49384d5c386bc3f1142c88b90613.tar.bz2 |
cloned from 'bitbucket', 2013/08/13
Diffstat (limited to '97suifangqa/staticfiles/markitup/sets/markdown/set.js')
-rw-r--r-- | 97suifangqa/staticfiles/markitup/sets/markdown/set.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/97suifangqa/staticfiles/markitup/sets/markdown/set.js b/97suifangqa/staticfiles/markitup/sets/markdown/set.js new file mode 100644 index 0000000..96970a4 --- /dev/null +++ b/97suifangqa/staticfiles/markitup/sets/markdown/set.js @@ -0,0 +1,52 @@ +// ------------------------------------------------------------------- +// markItUp! +// ------------------------------------------------------------------- +// Copyright (C) 2008 Jay Salvat +// http://markitup.jaysalvat.com/ +// ------------------------------------------------------------------- +// MarkDown tags example +// http://en.wikipedia.org/wiki/Markdown +// http://daringfireball.net/projects/markdown/ +// ------------------------------------------------------------------- +// Feel free to add more tags +// ------------------------------------------------------------------- +mySettings = { + previewParserPath: '', + onShiftEnter: {keepDefault:false, openWith:'\n\n'}, + markupSet: [ + {name:'First Level Heading', key:'1', placeHolder:'Your title here...', closeWith:function(markItUp) { return miu.markdownTitle(markItUp, '=') } }, + {name:'Second Level Heading', key:'2', placeHolder:'Your title here...', closeWith:function(markItUp) { return miu.markdownTitle(markItUp, '-') } }, + {name:'Heading 3', key:'3', openWith:'### ', placeHolder:'Your title here...' }, + {name:'Heading 4', key:'4', openWith:'#### ', placeHolder:'Your title here...' }, + {name:'Heading 5', key:'5', openWith:'##### ', placeHolder:'Your title here...' }, + {name:'Heading 6', key:'6', openWith:'###### ', placeHolder:'Your title here...' }, + {separator:'---------------' }, + {name:'Bold', key:'B', openWith:'**', closeWith:'**'}, + {name:'Italic', key:'I', openWith:'_', closeWith:'_'}, + {separator:'---------------' }, + {name:'Bulleted List', openWith:'- ' }, + {name:'Numeric List', openWith:function(markItUp) { + return markItUp.line+'. '; + }}, + {separator:'---------------' }, + {name:'Picture', key:'P', replaceWith:'![[![Alternative text]!]]([![Url:!:http://]!] "[![Title]!]")'}, + {name:'Link', key:'L', openWith:'[', closeWith:']([![Url:!:http://]!] "[![Title]!]")', placeHolder:'Your text to link here...' }, + {separator:'---------------'}, + {name:'Quotes', openWith:'> '}, + {name:'Code Block / Code', openWith:'(!(\t|!|`)!)', closeWith:'(!(`)!)'}, + {separator:'---------------'}, + {name:'Preview', call:'preview', className:"preview"} + ] +} + +// mIu nameSpace to avoid conflict. +miu = { + markdownTitle: function(markItUp, char) { + heading = ''; + n = $.trim(markItUp.selection||markItUp.placeHolder).length; + for(i = 0; i < n; i++) { + heading += char; + } + return '\n'+heading; + } +}
\ No newline at end of file |