view media/js/markitup/sets/markdown/set.js @ 11:cc8eb028def1

Update jquery-ui and theme version that is hosted on google. In preparation for having jquery on every page (?), make it so that the autocomplete plug is using the 'global' jquery, and not the one that came with it. It seems to work okay with jquery 1.3.2.
author Brian Neal <bgneal@gmail.com>
date Tue, 14 Apr 2009 02:35:35 +0000
parents dbd703f7d63a
children 5b69d6e01fd4
line wrap: on
line source
// -------------------------------------------------------------------
// 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: '/comments/markdown/',
	previewParserVar: 'data',
    previewInWindow: false,
    previewAutoRefresh: false,
    previewPosition: 'after',
	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:'Smilies', className:'smilies', dropMenu: [
            {name:'Argh', replaceWith:' :argh: ', className:'col1-1' },
            {name:'Grin', replaceWith:' :-D ', className:'col1-2' },
            {name:'Razz', replaceWith:' :-P ', className:'col1-3' },
            {name:'Confused', replaceWith:' o_O ', className:'col1-4' },
            {name:'Cool', replaceWith:' 8^) ', className:'col1-5' },
            {name:'Cry', replaceWith:' :-( ', className:'col2-1' },
            {name:'Dead', replaceWith:' x_x ', className:'col2-2' },
            {name:'Embarrassed', replaceWith:' :-# ', className:'col2-3' },
            {name:'LOL', replaceWith:' :lol: ', className:'col2-4' },
            {name:'Mad', replaceWith:' X-( ', className:'col2-5' },
            {name:'No', replaceWith:' :no: ', className:'col3-1' },
            {name:'None', replaceWith:' :-| ', className:'col3-2' },
            {name:'Shock', replaceWith:' :shock: ', className:'col3-3' },
            {name:'Sigh', replaceWith:' :sigh: ', className:'col3-4' },
            {name:'Smile', replaceWith:' :-) ', className:'col3-5' },
            {name:'Uh-oh', replaceWith:' :uh-oh: ', className:'col4-1' },
            {name:'Whatever', replaceWith:' :whatever: ', className:'col4-2' },
            {name:'Wink', replaceWith:' ;-) ', className:'col4-3' },
            {name:'Yes', replaceWith:' :yes: ', className:'col4-4' },
            {name:'Sleep', replaceWith:' :sleep: ', className:'col4-5' }
            ]
        },
		{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;
	}
}