kramdown-service 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Manifest.txt +1 -5
- data/README.md +2 -10
- data/Rakefile +2 -1
- data/lib/kramdown/service.rb +115 -57
- data/lib/kramdown/service/docs/welcome.md +3 -3
- data/lib/kramdown/service/public/js/kramdown.js +64 -0
- data/lib/kramdown/service/public/js/markdown.note.js +51 -13
- data/lib/kramdown/service/version.rb +2 -2
- data/lib/kramdown/service/views/_about.erb +4 -1
- data/lib/kramdown/service/views/_editor_head.erb +1 -4
- data/lib/kramdown/service/views/_libs_service.erb +2 -2
- data/lib/kramdown/service/views/_service.erb +35 -6
- metadata +17 -7
- data/lib/kramdown/service/public/js/lib3rd/pagedown.js +0 -1412
- data/lib/kramdown/service/public/js/lib3rd/showdown.min.js +0 -62
- data/lib/kramdown/service/public/js/markdown.api.js +0 -99
- data/lib/kramdown/service/public/js/markdown.lib.js +0 -82
- data/lib/kramdown/service/public/note.html +0 -72
@@ -1,62 +0,0 @@
|
|
1
|
-
//
|
2
|
-
// showdown.js -- A javascript port of Markdown.
|
3
|
-
//
|
4
|
-
// Copyright (c) 2007 John Fraser.
|
5
|
-
//
|
6
|
-
// Original Markdown Copyright (c) 2004-2005 John Gruber
|
7
|
-
// <http://daringfireball.net/projects/markdown/>
|
8
|
-
//
|
9
|
-
// Redistributable under a BSD-style open source license.
|
10
|
-
// See license.txt for more information.
|
11
|
-
//
|
12
|
-
// The full source distribution is at:
|
13
|
-
//
|
14
|
-
// A A L
|
15
|
-
// T C A
|
16
|
-
// T K B
|
17
|
-
//
|
18
|
-
// <http://www.attacklab.net/>
|
19
|
-
//
|
20
|
-
//
|
21
|
-
// Wherever possible, Showdown is a straight, line-by-line port
|
22
|
-
// of the Perl version of Markdown.
|
23
|
-
//
|
24
|
-
// This is not a normal parser design; it's basically just a
|
25
|
-
// series of string substitutions. It's hard to read and
|
26
|
-
// maintain this way, but keeping Showdown close to the original
|
27
|
-
// design makes it easier to port new features.
|
28
|
-
//
|
29
|
-
// More importantly, Showdown behaves like markdown.pl in most
|
30
|
-
// edge cases. So web applications can do client-side preview
|
31
|
-
// in Javascript, and then build identical HTML on the server.
|
32
|
-
//
|
33
|
-
// This port needs the new RegExp functionality of ECMA 262,
|
34
|
-
// 3rd Edition (i.e. Javascript 1.5). Most modern web browsers
|
35
|
-
// should do fine. Even with the new regular expression features,
|
36
|
-
// We do a lot of work to emulate Perl's regex functionality.
|
37
|
-
// The tricky changes in this file mostly have the "attacklab:"
|
38
|
-
// label. Major or self-explanatory changes don't.
|
39
|
-
//
|
40
|
-
// Smart diff tools like Araxis Merge will be able to match up
|
41
|
-
// this file with markdown.pl in a useful way. A little tweaking
|
42
|
-
// helps: in a copy of markdown.pl, replace "#" with "//" and
|
43
|
-
// replace "$text" with "text". Be sure to ignore whitespace
|
44
|
-
// and line endings.
|
45
|
-
//
|
46
|
-
//
|
47
|
-
// Showdown usage:
|
48
|
-
//
|
49
|
-
// var text = "Markdown *rocks*.";
|
50
|
-
//
|
51
|
-
// var converter = new Showdown.converter();
|
52
|
-
// var html = converter.makeHtml(text);
|
53
|
-
//
|
54
|
-
// alert(html);
|
55
|
-
//
|
56
|
-
// Note: move the sample code to the bottom of this
|
57
|
-
// file before uncommenting it.
|
58
|
-
//
|
59
|
-
//
|
60
|
-
// Showdown namespace
|
61
|
-
//
|
62
|
-
var Showdown={extensions:{}},forEach=Showdown.forEach=function(a,b){if(typeof a.forEach=="function")a.forEach(b);else{var c,d=a.length;for(c=0;c<d;c++)b(a[c],c,a)}},stdExtName=function(a){return a.replace(/[_-]||\s/g,"").toLowerCase()};Showdown.converter=function(a){var b,c,d,e=0,f=[],g=[];if(typeof module!="undefind"&&typeof exports!="undefined"&&typeof require!="undefind"){var h=require("fs");if(h){var i=h.readdirSync((__dirname||".")+"/extensions").filter(function(a){return~a.indexOf(".js")}).map(function(a){return a.replace(/\.js$/,"")});Showdown.forEach(i,function(a){var b=stdExtName(a);Showdown.extensions[b]=require("./extensions/"+a)})}}this.makeHtml=function(a){return b={},c={},d=[],a=a.replace(/~/g,"~T"),a=a.replace(/\$/g,"~D"),a=a.replace(/\r\n/g,"\n"),a=a.replace(/\r/g,"\n"),a="\n\n"+a+"\n\n",a=M(a),a=a.replace(/^[ \t]+$/mg,""),Showdown.forEach(f,function(b){a=k(b,a)}),a=z(a),a=m(a),a=l(a),a=o(a),a=K(a),a=a.replace(/~D/g,"$$"),a=a.replace(/~T/g,"~"),Showdown.forEach(g,function(b){a=k(b,a)}),a};if(a&&a.extensions){var j=this;Showdown.forEach(a.extensions,function(a){typeof a=="string"&&(a=Showdown.extensions[stdExtName(a)]);if(typeof a!="function")throw"Extension '"+a+"' could not be loaded. It was either not found or is not a valid extension.";Showdown.forEach(a(j),function(a){a.type?a.type==="language"||a.type==="lang"?f.push(a):(a.type==="output"||a.type==="html")&&g.push(a):g.push(a)})})}var k=function(a,b){if(a.regex){var c=new RegExp(a.regex,"g");return b.replace(c,a.replace)}if(a.filter)return a.filter(b)},l=function(a){return a+="~0",a=a.replace(/^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*<?(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|(?=~0))/gm,function(a,d,e,f,g){return d=d.toLowerCase(),b[d]=G(e),f?f+g:(g&&(c[d]=g.replace(/"/g,""")),"")}),a=a.replace(/~0/,""),a},m=function(a){a=a.replace(/\n/g,"\n\n");var b="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del|style|section|header|footer|nav|article|aside",c="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|style|section|header|footer|nav|article|aside";return a=a.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del)\b[^\r]*?\n<\/\2>[ \t]*(?=\n+))/gm,n),a=a.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|style|section|header|footer|nav|article|aside)\b[^\r]*?<\/\2>[ \t]*(?=\n+)\n)/gm,n),a=a.replace(/(\n[ ]{0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,n),a=a.replace(/(\n\n[ ]{0,3}<!(--[^\r]*?--\s*)+>[ \t]*(?=\n{2,}))/g,n),a=a.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,n),a=a.replace(/\n\n/g,"\n"),a},n=function(a,b){var c=b;return c=c.replace(/\n\n/g,"\n"),c=c.replace(/^\n/,""),c=c.replace(/\n+$/g,""),c="\n\n~K"+(d.push(c)-1)+"K\n\n",c},o=function(a){a=v(a);var b=A("<hr />");return a=a.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm,b),a=a.replace(/^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$/gm,b),a=a.replace(/^[ ]{0,2}([ ]?\_[ ]?){3,}[ \t]*$/gm,b),a=x(a),a=y(a),a=E(a),a=m(a),a=F(a),a},p=function(a){return a=B(a),a=q(a),a=H(a),a=t(a),a=r(a),a=I(a),a=G(a),a=D(a),a=a.replace(/ +\n/g," <br />\n"),a},q=function(a){var b=/(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|<!(--.*?--\s*)+>)/gi;return a=a.replace(b,function(a){var b=a.replace(/(.)<\/?code>(?=.)/g,"$1`");return b=N(b,"\\`*_"),b}),a},r=function(a){return a=a.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,s),a=a.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()<?(.*?(?:\(.*?\).*?)?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,s),a=a.replace(/(\[([^\[\]]+)\])()()()()()/g,s),a},s=function(a,d,e,f,g,h,i,j){j==undefined&&(j="");var k=d,l=e,m=f.toLowerCase(),n=g,o=j;if(n==""){m==""&&(m=l.toLowerCase().replace(/ ?\n/g," ")),n="#"+m;if(b[m]!=undefined)n=b[m],c[m]!=undefined&&(o=c[m]);else{if(!(k.search(/\(\s*\)$/m)>-1))return k;n=""}}n=N(n,"*_");var p='<a href="'+n+'"';return o!=""&&(o=o.replace(/"/g,"""),o=N(o,"*_"),p+=' title="'+o+'"'),p+=">"+l+"</a>",p},t=function(a){return a=a.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,u),a=a.replace(/(!\[(.*?)\]\s?\([ \t]*()<?(\S+?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,u),a},u=function(a,d,e,f,g,h,i,j){var k=d,l=e,m=f.toLowerCase(),n=g,o=j;o||(o="");if(n==""){m==""&&(m=l.toLowerCase().replace(/ ?\n/g," ")),n="#"+m;if(b[m]==undefined)return k;n=b[m],c[m]!=undefined&&(o=c[m])}l=l.replace(/"/g,"""),n=N(n,"*_");var p='<img src="'+n+'" alt="'+l+'"';return o=o.replace(/"/g,"""),o=N(o,"*_"),p+=' title="'+o+'"',p+=" />",p},v=function(a){function b(a){return a.replace(/[^\w]/g,"").toLowerCase()}return a=a.replace(/^(.+)[ \t]*\n=+[ \t]*\n+/gm,function(a,c){return A('<h1 id="'+b(c)+'">'+p(c)+"</h1>")}),a=a.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm,function(a,c){return A('<h2 id="'+b(c)+'">'+p(c)+"</h2>")}),a=a.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm,function(a,c,d){var e=c.length;return A("<h"+e+' id="'+b(d)+'">'+p(d)+"</h"+e+">")}),a},w,x=function(a){a+="~0";var b=/^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;return e?a=a.replace(b,function(a,b,c){var d=b,e=c.search(/[*+-]/g)>-1?"ul":"ol";d=d.replace(/\n{2,}/g,"\n\n\n");var f=w(d);return f=f.replace(/\s+$/,""),f="<"+e+">"+f+"</"+e+">\n",f}):(b=/(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g,a=a.replace(b,function(a,b,c,d){var e=b,f=c,g=d.search(/[*+-]/g)>-1?"ul":"ol",f=f.replace(/\n{2,}/g,"\n\n\n"),h=w(f);return h=e+"<"+g+">\n"+h+"</"+g+">\n",h})),a=a.replace(/~0/,""),a};w=function(a){return e++,a=a.replace(/\n{2,}$/,"\n"),a+="~0",a=a.replace(/(\n)?(^[ \t]*)([*+-]|\d+[.])[ \t]+([^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm,function(a,b,c,d,e){var f=e,g=b,h=c;return g||f.search(/\n{2,}/)>-1?f=o(L(f)):(f=x(L(f)),f=f.replace(/\n$/,""),f=p(f)),"<li>"+f+"</li>\n"}),a=a.replace(/~0/g,""),e--,a};var y=function(a){return a+="~0",a=a.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g,function(a,b,c){var d=b,e=c;return d=C(L(d)),d=M(d),d=d.replace(/^\n+/g,""),d=d.replace(/\n+$/g,""),d="<pre><code>"+d+"\n</code></pre>",A(d)+e}),a=a.replace(/~0/,""),a},z=function(a){return a+="~0",a=a.replace(/(?:^|\n)```(.*)\n([\s\S]*?)\n```/g,function(a,b,c){var d=b,e=c;return e=C(e),e=M(e),e=e.replace(/^\n+/g,""),e=e.replace(/\n+$/g,""),e="<pre><code"+(d?' class="'+d+'"':"")+">"+e+"\n</code></pre>",A(e)}),a=a.replace(/~0/,""),a},A=function(a){return a=a.replace(/(^\n+|\n+$)/g,""),"\n\n~K"+(d.push(a)-1)+"K\n\n"},B=function(a){return a=a.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(a,b,c,d,e){var f=d;return f=f.replace(/^([ \t]*)/g,""),f=f.replace(/[ \t]*$/g,""),f=C(f),b+"<code>"+f+"</code>"}),a},C=function(a){return a=a.replace(/&/g,"&"),a=a.replace(/</g,"<"),a=a.replace(/>/g,">"),a=N(a,"*_{}[]\\",!1),a},D=function(a){return a=a.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g,"<strong>$2</strong>"),a=a.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g,"<em>$2</em>"),a},E=function(a){return a=a.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm,function(a,b){var c=b;return c=c.replace(/^[ \t]*>[ \t]?/gm,"~0"),c=c.replace(/~0/g,""),c=c.replace(/^[ \t]+$/gm,""),c=o(c),c=c.replace(/(^|\n)/g,"$1 "),c=c.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm,function(a,b){var c=b;return c=c.replace(/^ /mg,"~0"),c=c.replace(/~0/g,""),c}),A("<blockquote>\n"+c+"\n</blockquote>")}),a},F=function(a){a=a.replace(/^\n+/g,""),a=a.replace(/\n+$/g,"");var b=a.split(/\n{2,}/g),c=[],e=b.length;for(var f=0;f<e;f++){var g=b[f];g.search(/~K(\d+)K/g)>=0?c.push(g):g.search(/\S/)>=0&&(g=p(g),g=g.replace(/^([ \t]*)/g,"<p>"),g+="</p>",c.push(g))}e=c.length;for(var f=0;f<e;f++)while(c[f].search(/~K(\d+)K/)>=0){var h=d[RegExp.$1];h=h.replace(/\$/g,"$$$$"),c[f]=c[f].replace(/~K\d+K/,h)}return c.join("\n\n")},G=function(a){return a=a.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&"),a=a.replace(/<(?![a-z\/?\$!])/gi,"<"),a},H=function(a){return a=a.replace(/\\(\\)/g,O),a=a.replace(/\\([`*_{}\[\]()>#+-.!])/g,O),a},I=function(a){return a=a.replace(/<((https?|ftp|dict):[^'">\s]+)>/gi,'<a href="$1">$1</a>'),a=a.replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,function(a,b){return J(K(b))}),a},J=function(a){var b=[function(a){return"&#"+a.charCodeAt(0)+";"},function(a){return"&#x"+a.charCodeAt(0).toString(16)+";"},function(a){return a}];return a="mailto:"+a,a=a.replace(/./g,function(a){if(a=="@")a=b[Math.floor(Math.random()*2)](a);else if(a!=":"){var c=Math.random();a=c>.9?b[2](a):c>.45?b[1](a):b[0](a)}return a}),a='<a href="'+a+'">'+a+"</a>",a=a.replace(/">.+:/g,'">'),a},K=function(a){return a=a.replace(/~E(\d+)E/g,function(a,b){var c=parseInt(b);return String.fromCharCode(c)}),a},L=function(a){return a=a.replace(/^(\t|[ ]{1,4})/gm,"~0"),a=a.replace(/~0/g,""),a},M=function(a){return a=a.replace(/\t(?=\t)/g," "),a=a.replace(/\t/g,"~A~B"),a=a.replace(/~B(.+?)~A/g,function(a,b,c){var d=b,e=4-d.length%4;for(var f=0;f<e;f++)d+=" ";return d}),a=a.replace(/~A/g," "),a=a.replace(/~B/g,""),a},N=function(a,b,c){var d="(["+b.replace(/([\[\]\\])/g,"\\$1")+"])";c&&(d="\\\\"+d);var e=new RegExp(d,"g");return a=a.replace(e,O),a},O=function(a,b){var c=b.charCodeAt(0);return"~E"+c+"E"}},typeof module!="undefined"&&(module.exports=Showdown),typeof define=="function"&&define.amd&&define("showdown",function(){return Showdown});
|
@@ -1,99 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
var markdown_apis_new = function() {
|
4
|
-
|
5
|
-
function _get_dingus( api_url, api_params, handle_html )
|
6
|
-
{
|
7
|
-
var api_params_str = $.param( api_params );
|
8
|
-
api_params_str += '&callback=?' // NB: add callback for jquery jsonp; NB: need to append as string to avoid encoding of =?
|
9
|
-
|
10
|
-
$.getJSON( api_url, api_params_str, function( data ) {
|
11
|
-
handle_html( data.html ); // NB: assumes response { 'html': 'markup here' }
|
12
|
-
});
|
13
|
-
}
|
14
|
-
|
15
|
-
function _get_dingus_via_proxy( api_url, api_params, handle_html )
|
16
|
-
{
|
17
|
-
api_params.url = api_url; // add url to params
|
18
|
-
var api_proxy_url = 'http://note.herokuapp.com/proxy'
|
19
|
-
|
20
|
-
_get_dingus( api_proxy_url, api_params, handle_html );
|
21
|
-
}
|
22
|
-
|
23
|
-
function _ruby_w_lib( text, lib, handle_html )
|
24
|
-
{
|
25
|
-
var api_params = {
|
26
|
-
text: text,
|
27
|
-
lib: lib
|
28
|
-
}
|
29
|
-
var api_url = 'http://note.herokuapp.com/markdown/dingus';
|
30
|
-
|
31
|
-
_get_dingus( api_url, api_params, handle_html );
|
32
|
-
}
|
33
|
-
|
34
|
-
|
35
|
-
function ruby( text, handle_html )
|
36
|
-
{
|
37
|
-
var api_params = {
|
38
|
-
text: text
|
39
|
-
}
|
40
|
-
var api_url = 'http://note.herokuapp.com/markdown/dingus';
|
41
|
-
|
42
|
-
_get_dingus( api_url, api_params, handle_html );
|
43
|
-
}
|
44
|
-
|
45
|
-
function pandoc( text, handle_html )
|
46
|
-
{
|
47
|
-
// NB: note jsonp enabled - no cross domain request possible; use proxy server or similar
|
48
|
-
// todo: find other service
|
49
|
-
var api_params = {
|
50
|
-
text: text
|
51
|
-
}
|
52
|
-
var api_url = 'http://johnmacfarlane.net/cgi-bin/pandoc-dingus'
|
53
|
-
|
54
|
-
_get_dingus_via_proxy( api_url, api_params, handle_html );
|
55
|
-
}
|
56
|
-
|
57
|
-
|
58
|
-
function kramdown( text, handle_html )
|
59
|
-
{
|
60
|
-
_ruby_w_lib( text, 'kramdown', handle_html );
|
61
|
-
}
|
62
|
-
|
63
|
-
function maruku( text, handle_html )
|
64
|
-
{
|
65
|
-
_ruby_w_lib( text, 'maruku', handle_html );
|
66
|
-
}
|
67
|
-
|
68
|
-
function redcarpet( text, handle_html )
|
69
|
-
{
|
70
|
-
_ruby_w_lib( text, 'redcarpet', handle_html );
|
71
|
-
}
|
72
|
-
|
73
|
-
function bluecloth( text, handle_html )
|
74
|
-
{
|
75
|
-
_ruby_w_lib( text, 'bluecloth', handle_html );
|
76
|
-
}
|
77
|
-
|
78
|
-
return {
|
79
|
-
ruby: ruby,
|
80
|
-
ruby_kramdown: kramdown,
|
81
|
-
ruby_maruku: maruku,
|
82
|
-
ruby_redcarpet: redcarpet,
|
83
|
-
ruby_bluecloth: bluecloth,
|
84
|
-
pandoc: pandoc
|
85
|
-
}
|
86
|
-
} // fn makrdown_apis_new
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
var markdown_apis = markdown_apis_new();
|
91
|
-
|
92
|
-
////////////////
|
93
|
-
// use like
|
94
|
-
//
|
95
|
-
// markdown_apis.ruby( text, success );
|
96
|
-
// markdown_apis.ruby_kramdown( text, success );
|
97
|
-
// mardkown_apis.pandoc( text, success );
|
98
|
-
// etc.
|
99
|
-
|
@@ -1,82 +0,0 @@
|
|
1
|
-
|
2
|
-
var markdown_libs_new = function() {
|
3
|
-
|
4
|
-
// Showdown usage:
|
5
|
-
//
|
6
|
-
// var text = "Markdown *rocks*.";
|
7
|
-
//
|
8
|
-
// var converter = new Showdown.converter();
|
9
|
-
// var html = converter.makeHtml(text);
|
10
|
-
//
|
11
|
-
// alert(html);
|
12
|
-
|
13
|
-
var showdownConverter;
|
14
|
-
|
15
|
-
|
16
|
-
// pagedown Usage:
|
17
|
-
//
|
18
|
-
// var text = "Markdown *rocks*.";
|
19
|
-
//
|
20
|
-
// var converter = new Markdown.Converter();
|
21
|
-
// var html = converter.makeHtml(text);
|
22
|
-
//
|
23
|
-
// alert(html);
|
24
|
-
//
|
25
|
-
|
26
|
-
var pagedownConverter;
|
27
|
-
|
28
|
-
function showdown( text, handle_html )
|
29
|
-
{
|
30
|
-
// todo: get version from code possible? how?
|
31
|
-
|
32
|
-
var html = showdownConverter.makeHtml( text );
|
33
|
-
|
34
|
-
var banner_begin = "<!-- === begin markdown block ===\n" +
|
35
|
-
"\n" +
|
36
|
-
" generated by Showdown on " + navigator.userAgent + "\n" +
|
37
|
-
" on " + new Date().toString() + "\n" +
|
38
|
-
"-->\n\n"
|
39
|
-
|
40
|
-
var banner_end = "\n\n<!-- === end markdown block === -->";
|
41
|
-
|
42
|
-
handle_html( banner_begin + html + banner_end );
|
43
|
-
}
|
44
|
-
|
45
|
-
function pagedown( text, handle_html )
|
46
|
-
{
|
47
|
-
var html = pagedownConverter.makeHtml( text );
|
48
|
-
|
49
|
-
var banner_begin = "<!-- === begin markdown block ===\n" +
|
50
|
-
"\n" +
|
51
|
-
" generated by pagedown on " + navigator.userAgent + "\n" +
|
52
|
-
" on " + new Date().toString() + "\n" +
|
53
|
-
"-->\n\n"
|
54
|
-
|
55
|
-
var banner_end = "\n\n<!-- === end markdown block === -->";
|
56
|
-
|
57
|
-
handle_html( banner_begin + html + banner_end );
|
58
|
-
}
|
59
|
-
|
60
|
-
|
61
|
-
function _init()
|
62
|
-
{
|
63
|
-
showdownConverter = new Showdown.converter();
|
64
|
-
pagedownConverter = new Markdown.Converter();
|
65
|
-
}
|
66
|
-
|
67
|
-
_init();
|
68
|
-
|
69
|
-
return {
|
70
|
-
showdown: showdown,
|
71
|
-
pagedown: pagedown
|
72
|
-
}
|
73
|
-
} // fn makrdown_libs_new
|
74
|
-
|
75
|
-
|
76
|
-
var markdown_libs = markdown_libs_new();
|
77
|
-
|
78
|
-
////////////////
|
79
|
-
// use like
|
80
|
-
//
|
81
|
-
// markdown_libs.showdown( text, success );
|
82
|
-
// etc.
|
@@ -1,72 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<meta charset='UTF-8'>
|
5
|
-
<title>Markdown Note</title>
|
6
|
-
|
7
|
-
<link href='css/markdown/note.css' rel='stylesheet'>
|
8
|
-
<link href='css/markdown/themes/basic.css' rel='stylesheet'>
|
9
|
-
|
10
|
-
<script src='js/lib3rd/jquery-2.0.1.min.js'></script>
|
11
|
-
<script src='js/lib3rd/showdown.min.js'></script>
|
12
|
-
<script src='js/lib3rd/pagedown.js'></script>
|
13
|
-
|
14
|
-
<script src='js/markdown.api.js'></script>
|
15
|
-
<script src='js/markdown.lib.js'></script>
|
16
|
-
|
17
|
-
<script src='js/markdown.note.js'></script>
|
18
|
-
<script>
|
19
|
-
$(document).ready( function () {
|
20
|
-
markdown_note_new();
|
21
|
-
});
|
22
|
-
</script>
|
23
|
-
</head>
|
24
|
-
<body>
|
25
|
-
|
26
|
-
|
27
|
-
<table width='100%'>
|
28
|
-
<colgroup>
|
29
|
-
<col width='50%'>
|
30
|
-
<col width='50%'>
|
31
|
-
</colgroup>
|
32
|
-
<tr>
|
33
|
-
<td>
|
34
|
-
<!-- first column -->
|
35
|
-
|
36
|
-
<div id='input'>
|
37
|
-
<textarea id='note' class='black'></textarea>
|
38
|
-
</div>
|
39
|
-
|
40
|
-
</td>
|
41
|
-
<td style='vertical-align: top;'>
|
42
|
-
<!-- second column -->
|
43
|
-
|
44
|
-
<div id='output' class='markdown'></div>
|
45
|
-
<textarea id='output-source' readonly='readonly'></textarea>
|
46
|
-
|
47
|
-
</td>
|
48
|
-
</tr>
|
49
|
-
<tr>
|
50
|
-
<td>
|
51
|
-
<!-- first column -->
|
52
|
-
|
53
|
-
<span>
|
54
|
-
Use <select id='note-lib'></select>
|
55
|
-
</span>
|
56
|
-
|
57
|
-
<a id='output-update' href='#'>[ Update ]</a>
|
58
|
-
<a id='input-toggle' href='#'>[ Use White Color Theme ]</a>
|
59
|
-
|
60
|
-
<!-- nb: div will break/start new line -->
|
61
|
-
<div id='output-loading'></div>
|
62
|
-
</td>
|
63
|
-
<td style='vertical-align: top;'>
|
64
|
-
<!-- second column -->
|
65
|
-
<a id='output-toggle' href='#'>[ Show HTML ]</a>
|
66
|
-
|
67
|
-
</td>
|
68
|
-
</tr>
|
69
|
-
</table>
|
70
|
-
|
71
|
-
</body>
|
72
|
-
</html>
|