var markdown_libs_new = function() { // Showdown usage: // // var text = "Markdown *rocks*."; // // var converter = new Showdown.converter(); // var html = converter.makeHtml(text); // // alert(html); var showdownConverter; // pagedown Usage: // // var text = "Markdown *rocks*."; // // var converter = new Markdown.Converter(); // var html = converter.makeHtml(text); // // alert(html); // var pagedownConverter; function showdown( text, handle_html ) { // todo: get version from code possible? how? var html = showdownConverter.makeHtml( text ); var banner_begin = "\n\n" var banner_end = "\n\n"; handle_html( banner_begin + html + banner_end ); } function pagedown( text, handle_html ) { var html = pagedownConverter.makeHtml( text ); var banner_begin = "\n\n" var banner_end = "\n\n"; handle_html( banner_begin + html + banner_end ); } function _init() { showdownConverter = new Showdown.converter(); pagedownConverter = new Markdown.Converter(); } _init(); return { showdown: showdown, pagedown: pagedown } } // fn makrdown_libs_new var markdown_libs = markdown_libs_new(); //////////////// // use like // // markdown_libs.showdown( text, success ); // etc.