├── css └── custom.css ├── ex ├── codeprint.pdf ├── customfonts.pdf ├── ex.html ├── fulldoc.pdf ├── markdown.pdf ├── smartypants.pdf ├── textile.pdf └── visualstudio-theme.pdf ├── favicon.ico ├── index.html ├── js ├── coffeescript │ ├── compile.bat │ ├── compiled │ │ ├── parameter.js │ │ ├── printer.js │ │ └── window.js │ ├── parameter.coffee │ ├── printer.coffee │ └── window.coffee ├── gistprint.js ├── highlight.pack.js └── parsers │ ├── marked.min.js │ └── textile.min.js ├── readme └── url.html /css/custom.css: -------------------------------------------------------------------------------- 1 | /* 2 | I'm so sorry... 3 | The fact that you are reading this means you will have to excuse my shitty CSS... 4 | It gets the job done, I guess. I just beautified it for your sake 5 | - Ethan 6 | */ 7 | 8 | @media print { 9 | body { 10 | width: 100%; 11 | margin: 0px; 12 | float: none; 13 | padding: none; 14 | line-height: 1.4; 15 | } 16 | #header, 17 | #e, 18 | .noprint { 19 | display: none; 20 | } 21 | } 22 | body { 23 | font-family: 'Merriweather', serif; 24 | } 25 | .typed-cursor { 26 | opacity: 1; 27 | -webkit-animation: blink 0.7s infinite; 28 | -moz-animation: blink 0.7s infinite; 29 | animation: blink 0.7s infinite; 30 | } 31 | @keyframes blink { 32 | 0% { 33 | opacity: 1; 34 | } 35 | 50% { 36 | opacity: 0; 37 | } 38 | 100% { 39 | opacity: 1; 40 | } 41 | } 42 | @-webkit-keyframes blink { 43 | 0% { 44 | opacity: 1; 45 | } 46 | 50% { 47 | opacity: 0; 48 | } 49 | 100% { 50 | opacity: 1; 51 | } 52 | } 53 | @-moz-keyframes blink { 54 | 0% { 55 | opacity: 1; 56 | } 57 | 50% { 58 | opacity: 0; 59 | } 60 | 100% { 61 | opacity: 1; 62 | } 63 | } 64 | pre { 65 | background-color: white; 66 | border: none; 67 | white-space: pre-wrap; 68 | /* css-3 */ 69 | 70 | white-space: -moz-pre-wrap; 71 | /* Mozilla, since 1999 */ 72 | 73 | white-space: -pre-wrap; 74 | /* Opera 4-6 */ 75 | 76 | white-space: -o-pre-wrap; 77 | /* Opera 7 */ 78 | 79 | word-wrap: break-word; 80 | } 81 | .markdown-input { 82 | border: 3px solid #cccccc; 83 | padding: 5px; 84 | font-family: inherit; 85 | resize: none; 86 | width: 100%; 87 | height: 70pt; 88 | } 89 | .code-input { 90 | border: 3px solid #cccccc; 91 | padding: 5px; 92 | font-family: "Inconsolata", monospace; 93 | resize: none; 94 | width: 100%; 95 | height: 100pt; 96 | } 97 | .input { 98 | font-family: inherit; 99 | border: 3px solid #cccccc; 100 | width: 100%; 101 | padding: 5px; 102 | } 103 | #mdtitle { 104 | transition: color 3s; 105 | } 106 | #e { 107 | padding-top: 50px; 108 | } 109 | .num { 110 | width: 40px; 111 | height: 25px; 112 | } 113 | .code { 114 | width: 100%; 115 | height: 100%; 116 | } 117 | #cont { 118 | text-align: justify; 119 | } 120 | 121 | /* Font options. */ 122 | .lato { 123 | font-family: 'Lato', sans-serif; 124 | } 125 | .gloria { 126 | font-family: 'Gloria Hallelujah'; 127 | } 128 | .opensans { 129 | font-family: 'Open Sans', sans-serif; 130 | } 131 | .merriweather { 132 | font-family: 'Merriweather', serif; 133 | } 134 | .inconsolata { 135 | font-family: 'Inconsolata'; 136 | } 137 | -------------------------------------------------------------------------------- /ex/codeprint.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ethel-dev/simplemark/f5c0c49f8de46cd62ca58eab3e7ec38318d3bea3/ex/codeprint.pdf -------------------------------------------------------------------------------- /ex/customfonts.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ethel-dev/simplemark/f5c0c49f8de46cd62ca58eab3e7ec38318d3bea3/ex/customfonts.pdf -------------------------------------------------------------------------------- /ex/ex.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Sexydown Examples 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 41 |
42 |

Sexydown Examples

43 |
44 |
textile.pdf
45 |
some rendered Textile markup
46 |
markdown.pdf
47 |
some rendered Markdown markup
48 |
smartypants.pdf
49 |
font size and Smartypants quotes
50 |
customfonts.pdf
51 |
custom fonts with Sexydown
52 |
fulldoc.pdf
53 |
a full document printed with Sexydown
54 |
codeprint.pdf
55 |
the old source of Sexydown printed with the code printer
56 |
visualstudio-theme.pdf
57 |
the Linux panic file of the kernel printed with the Visual Studio theme in Sexydown
58 |
59 |

Each .pdf file was printed with Google Chrome, straight from Sexydown's output.

60 |
61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /ex/fulldoc.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ethel-dev/simplemark/f5c0c49f8de46cd62ca58eab3e7ec38318d3bea3/ex/fulldoc.pdf -------------------------------------------------------------------------------- /ex/markdown.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ethel-dev/simplemark/f5c0c49f8de46cd62ca58eab3e7ec38318d3bea3/ex/markdown.pdf -------------------------------------------------------------------------------- /ex/smartypants.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ethel-dev/simplemark/f5c0c49f8de46cd62ca58eab3e7ec38318d3bea3/ex/smartypants.pdf -------------------------------------------------------------------------------- /ex/textile.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ethel-dev/simplemark/f5c0c49f8de46cd62ca58eab3e7ec38318d3bea3/ex/textile.pdf -------------------------------------------------------------------------------- /ex/visualstudio-theme.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ethel-dev/simplemark/f5c0c49f8de46cd62ca58eab3e7ec38318d3bea3/ex/visualstudio-theme.pdf -------------------------------------------------------------------------------- /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ethel-dev/simplemark/f5c0c49f8de46cd62ca58eab3e7ec38318d3bea3/favicon.ico -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Simplemark 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 |
50 |
51 |
52 | 80 |
81 |
82 |
83 |

Simplemark: A simple way to print Markdown.

84 |

85 |

Simplemark is a useful, completely public domain, free website that prints code beautifully minimalistic on paper. It can compile Markdown and Textile markup to HTML and print it with a variety of options, and it can print 118 languages in beautifully syntax-highlighted glory on paper. Better yet, you can create a custom URL using the URL generator that will check the options for you. Simplemark has many new features that make it a fully-featured printing utility belt that you'll keep in your bookmarks for all eternity. If you're a nerd, you will be pleased to hear that Simplemark is public domain on GitHub.

86 |
87 |
88 |
89 |

Put Markdown code here:

90 | 91 |
92 | 93 | 94 |
95 | 96 | 97 |
98 |

Markdown Options:

99 |   Enable GitHub Flavored Markdown? 100 |
101 |   Enable smart lists? 102 |
103 |   Sanitize Markdown code (ignore anything other than Markdown code)? 104 |
105 |   Use pedantic Markdown? 106 |
107 |   Enable SmartyPants (use 'smart' quotes and dashes)? 108 |
109 |
110 |
111 |
112 |

Other Options:

113 |   Enable Textile? 114 |
115 | Font size:   116 |   117 | 122 |
123 | Font family:   124 | 131 |
132 |
133 | 134 |
135 |
136 |
137 | 138 | 139 |
140 |
141 | 142 | 143 | 144 |
145 | 146 | 147 |
148 | 149 |
150 | 157 |
158 |
159 | 160 |
161 | 162 |
163 |
164 | 165 |
166 |
167 |
168 |
169 | 170 | 194 | 195 | 196 | -------------------------------------------------------------------------------- /js/coffeescript/compile.bat: -------------------------------------------------------------------------------- 1 | REM This is a simple batch file that will quickly compile the CoffeeScript in here to 2 | REM JavaScript in the "compiled" directory. You should have installed CoffeeScript's 3 | REM compiler globally with NPM and Node, and without those installed this batch script 4 | REM will not work. So yeah, just install CoffeeScript. Instructions here: 5 | REM http://coffeescript.org/#installation 6 | 7 | @echo off 8 | coffee -c -o compiled/ . 9 | -------------------------------------------------------------------------------- /js/coffeescript/compiled/parameter.js: -------------------------------------------------------------------------------- 1 | // Generated by CoffeeScript 1.10.0 2 | var arrayQuery, generateurl, loadparams; 3 | 4 | arrayQuery = function() { 5 | var i, pair, pairs, request, url; 6 | url = window.location.href; 7 | request = {}; 8 | pairs = url.substring(url.indexOf('?') + 1).split('&'); 9 | i = 0; 10 | while (i < pairs.length) { 11 | pair = pairs[i].split('='); 12 | request[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]); 13 | i++; 14 | } 15 | return request; 16 | }; 17 | 18 | loadparams = function() { 19 | var code, ctheme, ff, fs, gfm, gistid, lists, pedant, query, san, sp, theme, txt, val; 20 | query = arrayQuery(); 21 | gfm = query['gfm']; 22 | lists = query['sl']; 23 | san = query['san']; 24 | pedant = query['ped']; 25 | sp = query['sp']; 26 | txt = query['txt']; 27 | fs = query['fs']; 28 | ff = query['ff']; 29 | val = decodeURIComponent(query['val']); 30 | gistid = decodeURIComponent(query['gistid']); 31 | code = query['code']; 32 | theme = query['theme']; 33 | ctheme = decodeURIComponent(query['ctheme']); 34 | if (code !== 'true' || code === void 0) { 35 | if (query['val'] === void 0) { 36 | document.getElementById('ugly').value = ''; 37 | } else { 38 | document.getElementById('ugly').value = val; 39 | } 40 | if (query['gistid'] !== void 0) { 41 | $.ajax({ 42 | url: 'https://api.github.com/gists/' + gistid, 43 | type: 'GET', 44 | dataType: 'jsonp' 45 | }).success(function(gistdata) { 46 | var content, names; 47 | names = Object.keys(gistdata.data.files); 48 | content = gistdata.data.files[names[0]].content; 49 | document.getElementById('ugly').value = content; 50 | console.log('Gist ' + gistid + ' loaded successfully.'); 51 | }).error(function(e) { 52 | console.log('There was an error loading Gist ' + gistid); 53 | }); 54 | } 55 | if (gfm === 'true') { 56 | $('#gfm').attr('checked', true); 57 | } else if (gfm === 'false') { 58 | $('#gfm').attr('checked', false); 59 | } else { 60 | $('#gfm').attr('checked', true); 61 | } 62 | if (lists === 'true') { 63 | $('#smartlists').attr('checked', true); 64 | } else if (lists === 'false') { 65 | $('#smartlists').attr('checked', false); 66 | } else { 67 | $('#gfm').attr('checked', true); 68 | } 69 | if (san === 'true') { 70 | $('#sanitize').attr('checked', true); 71 | } else { 72 | $('#sanitize').attr('checked', false); 73 | } 74 | if (pedant === 'true') { 75 | $('#pedantic').attr('checked', true); 76 | } else { 77 | $('#pedantic').attr('checked', false); 78 | } 79 | if (sp === 'true') { 80 | $('#smartypants').attr('checked', true); 81 | } else { 82 | $('#smartypants').attr('checked', false); 83 | } 84 | if (txt === 'true') { 85 | $('#txt').attr('checked', true); 86 | mddisable(); 87 | } else { 88 | $('#txt').attr('checked', false); 89 | } 90 | if (fs === null || fs === '' || fs === void 0) { 91 | document.getElementById('font-size').value = '12'; 92 | } else { 93 | document.getElementById('font-size').value = fs; 94 | } 95 | switch (ff) { 96 | case 'lato': 97 | document.getElementById('font-family').selectedIndex = 0; 98 | break; 99 | case 'gloria': 100 | document.getElementById('font-family').selectedIndex = 1; 101 | break; 102 | case 'opensans': 103 | document.getElementById('font-family').selectedIndex = 2; 104 | break; 105 | case 'merri': 106 | document.getElementById('font-family').selectedIndex = 3; 107 | break; 108 | case 'incons': 109 | document.getElementById('font-family').selectedIndex = 4; 110 | break; 111 | default: 112 | document.getElementById('font-family').selectedIndex = 3; 113 | break; 114 | } 115 | return 'Done getting parameters.'; 116 | } else { 117 | windowcontroller('code'); 118 | if (query['val'] === void 0) { 119 | document.getElementById('sourcecode').value = ''; 120 | } else { 121 | document.getElementById('sourcecode').value = val; 122 | } 123 | if (theme === void 0) { 124 | document.getElementById('theme').selectedIndex = 0; 125 | } else if (theme === 4) { 126 | $('#custom').collapse('show'); 127 | document.getElementById('customlink').value = ctheme; 128 | } else if (theme !== void 0) { 129 | document.getElementById('theme').selectedIndex = theme; 130 | } 131 | if (query['gistid'] !== void 0) { 132 | $.ajax({ 133 | url: 'https://api.github.com/gists/' + gistid, 134 | type: 'GET', 135 | dataType: 'jsonp' 136 | }).success(function(gistdata) { 137 | var content, lang, names; 138 | names = Object.keys(gistdata.data.files); 139 | content = gistdata.data.files[names[0]].content; 140 | lang = gistdata.data.files[names[0]].language; 141 | document.getElementById('sourcecode').value = content; 142 | document.getElementById('lang').value = lang; 143 | console.log('Gist ' + gistid + ' loaded successfully.'); 144 | }).error(function(e) { 145 | console.log('There was an error loading Gist ' + gistid); 146 | }); 147 | } 148 | return 'Done getting parameters for code.'; 149 | } 150 | }; 151 | 152 | generateurl = function() { 153 | var code, customlink, ff, font_family, font_size, gfm, gist, link, pedantic, sanitize, smartlists, smartypants, theme, txt, val; 154 | font_size = document.getElementById('font-size').value; 155 | font_family = document.getElementById('font-family').selectedIndex; 156 | gfm = document.getElementById('gfm').checked.toString(); 157 | sanitize = document.getElementById('sanitize').checked.toString(); 158 | pedantic = document.getElementById('pedantic').checked.toString(); 159 | smartypants = document.getElementById('smartypants').checked.toString(); 160 | smartlists = document.getElementById('smartlists').checked.toString(); 161 | txt = document.getElementById('txt').checked.toString(); 162 | code = document.getElementById('code').checked.toString(); 163 | val = encodeURIComponent(document.getElementById('url-text').value); 164 | gist = encodeURIComponent(document.getElementById('gistid').value); 165 | theme = document.getElementById('theme').selectedIndex; 166 | customlink = encodeURIComponent(document.getElementById('customlink').value); 167 | if (code === 'false') { 168 | ff = void 0; 169 | switch (font_family) { 170 | case 0: 171 | ff = 'lato'; 172 | break; 173 | case 1: 174 | ff = 'gloria'; 175 | break; 176 | case 2: 177 | ff = 'opensans'; 178 | break; 179 | case 3: 180 | ff = 'merri'; 181 | break; 182 | case 4: 183 | ff = 'incons'; 184 | } 185 | link = 'https://soops.github.io/simplemark/?gfm=' + gfm + '&sl=' + smartlists + '&san=' + sanitize + '&ped=' + pedantic + '&sp=' + smartypants + '&txt=' + txt + '&fs=' + font_size + '&ff=' + ff + '&val=' + val + '&gistid=' + gist; 186 | } else { 187 | if (customlink === '') { 188 | link = 'https://soops.github.io/simplemark/?code=' + code + '&val=' + val + '&gistid=' + gist + '&theme=' + theme; 189 | } else { 190 | link = 'https://soops.github.io/simplemark/?code=' + code + '&val=' + val + '&gistid=' + gist + '&theme=4&ctheme=' + customlink; 191 | } 192 | } 193 | document.getElementById('link').innerHTML = link; 194 | $('#link').attr('href', link); 195 | }; 196 | -------------------------------------------------------------------------------- /js/coffeescript/compiled/printer.js: -------------------------------------------------------------------------------- 1 | // Generated by CoffeeScript 1.10.0 2 | var papercode, sexydown, sexydownPart2; 3 | 4 | sexydown = function() { 5 | var gistid, mdFileUpload, mdGist, reader, uglyText; 6 | $("#modedrop").fadeOut(); 7 | uglyText = document.getElementById("ugly"); 8 | mdGist = document.getElementById("md-gist"); 9 | mdFileUpload = document.getElementById("md-fileupload"); 10 | if (mdGist.getAttribute("disabled") === "disabled" && uglyText.getAttribute("disabled") === "disabled") { 11 | if (window.File && window.FileReader && window.FileList && window.Blob) { 12 | reader = new FileReader(); 13 | reader.onload = function() { 14 | if (typeof console !== "undefined" && console !== null) { 15 | console.log("Opened file:\nContents:\n" + reader.result); 16 | } 17 | sexydownPart2(reader.result); 18 | }; 19 | reader.readAsText(mdFileUpload.files[0]); 20 | return; 21 | } else { 22 | alert("The file APIs are not supported by your browser."); 23 | return; 24 | } 25 | } 26 | if (uglyText.getAttribute("disabled") === "disabled" && mdFileUpload.getAttribute("disabled") === "disabled") { 27 | gistid = mdGist.value; 28 | $.ajax({ 29 | url: "https://api.github.com/gists/" + gistid, 30 | type: "GET", 31 | dataType: "jsonp", 32 | success: function(gistdata) { 33 | var content, names; 34 | names = Object.keys(gistdata.data.files); 35 | content = gistdata.data.files[names[0]].content; 36 | if (typeof console !== "undefined" && console !== null) { 37 | console.log("Gist " + gistid + " loaded successfully."); 38 | } 39 | sexydownPart2(content); 40 | }, 41 | error: function(e) { 42 | if (typeof console !== "undefined" && console !== null) { 43 | console.log("Gist " + gistid + " could not load. The following error was given:\n " + e); 44 | } 45 | } 46 | }); 47 | return; 48 | } 49 | if (document.getElementById('md-fileupload').getAttribute('disabled') === 'disabled' && document.getElementById('md-gist').getAttribute('disabled') === 'disabled') { 50 | disabler("md-fileupload", "md-gist", "ugly"); 51 | return sexydownPart2($('#ugly').val()); 52 | } 53 | }; 54 | 55 | sexydownPart2 = function(u) { 56 | var font_family, font_ms, font_size, gfm, measurement, pedantic, s, sanitize, smartlists, smartypants, txt; 57 | font_size = document.getElementById('font-size').value; 58 | font_ms = document.getElementById('font-measure').selectedIndex; 59 | font_family = document.getElementById('font-family').selectedIndex; 60 | switch (font_ms) { 61 | case 0: 62 | measurement = "pt"; 63 | break; 64 | case 1: 65 | measurement = "px"; 66 | break; 67 | case 2: 68 | measurement = "rem"; 69 | } 70 | font_size = font_size + measurement; 71 | switch (font_family) { 72 | case 0: 73 | $("#cont").addClass("lato"); 74 | break; 75 | case 1: 76 | $("#cont").addClass("gloria"); 77 | break; 78 | case 2: 79 | $("#cont").addClass("opensans"); 80 | break; 81 | case 3: 82 | $("#cont").addClass("merriweather"); 83 | break; 84 | case 4: 85 | $("#cont").addClass("inconsolata"); 86 | } 87 | txt = document.getElementById("txt").checked; 88 | if (txt === true) { 89 | s = textile(u); 90 | document.getElementById("cont").innerHTML = s; 91 | return window.setTimeout(function() { 92 | $("#cont > p").css("font-size", font_size); 93 | window.print(); 94 | }, 100); 95 | } else { 96 | gfm = document.getElementById("gfm").checked; 97 | sanitize = document.getElementById("sanitize").checked; 98 | pedantic = document.getElementById("pedantic").checked; 99 | smartypants = document.getElementById("smartypants").checked; 100 | smartlists = document.getElementById("smartlists").checked; 101 | marked.setOptions({ 102 | renderer: new marked.Renderer(), 103 | gfm: gfm, 104 | tables: gfm, 105 | breaks: gfm, 106 | pedantic: pedantic, 107 | sanitize: sanitize, 108 | smartLists: smartlists, 109 | smartypants: smartypants 110 | }); 111 | s = marked(u); 112 | document.getElementById("cont").innerHTML = s; 113 | return window.setTimeout(function() { 114 | $("#cont > p").css("font-size", font_size); 115 | window.print(); 116 | }, 100); 117 | } 118 | }; 119 | 120 | papercode = function() { 121 | var capitalizedLang, code, codeFileUpload, codeGist, codeText, gistid, lang, newelement, output, reader, style; 122 | $("link[title=bootstrap]")[0].remove(); 123 | lang = document.getElementById('lang').value; 124 | output = document.getElementById('codeoutput'); 125 | style = document.getElementById('theme').selectedIndex; 126 | switch (style) { 127 | case 0: 128 | $('.github, .xcode, .vs').remove(); 129 | break; 130 | case 1: 131 | $('.xcode, .vs, .googlecode').remove(); 132 | break; 133 | case 2: 134 | $('.github, .vs, .googlecode').remove(); 135 | break; 136 | case 3: 137 | $('.github, .xcode, .googlecode').remove(); 138 | break; 139 | case 4: 140 | $('.github, .xcode, .googlecode, .vs').remove(); 141 | newelement = ''; 142 | $('head').append(newelement); 143 | } 144 | codeText = document.getElementById("sourcecode"); 145 | codeGist = document.getElementById("gist"); 146 | codeFileUpload = document.getElementById("fileupload"); 147 | if (codeText.getAttribute("disabled") === "disabled" && codeGist.getAttribute("disabled") === "disabled") { 148 | if (window.File && window.FileReader && window.FileList && window.Blob) { 149 | reader = new FileReader(); 150 | reader.onload = function() { 151 | var code; 152 | $('#all').hide(); 153 | $('#codepre').collapse('show'); 154 | if (typeof console !== "undefined" && console !== null) { 155 | console.log('Opened file.\nContents:\n' + reader.result); 156 | } 157 | code = reader.result; 158 | output.innerText = code; 159 | $('pre code').each(function(i, block) { 160 | hljs.highlightBlock(block); 161 | }); 162 | document.title = 'Sexydown - Code Document'; 163 | window.print(); 164 | }; 165 | reader.readAsText(codeFileUpload.files[0]); 166 | } else { 167 | alert("The file APIs are not supported by your browser."); 168 | } 169 | } else { 170 | if (codeText.getAttribute("disabled") === "disabled" && codeFileUpload.getAttribute("disabled") === "disabled") { 171 | gistid = $('#gist').val(); 172 | return $.ajax({ 173 | url: 'https://api.github.com/gists/' + gistid, 174 | type: 'GET', 175 | dataType: 'jsonp' 176 | }).success(function(gistdata) { 177 | var capitalizedLang, code, names; 178 | $('#all').hide(); 179 | $('#codepre').collapse('show'); 180 | names = Object.keys(gistdata.data.files); 181 | code = gistdata.data.files[names[0]].content; 182 | lang = gistdata.data.files[names[0]].language; 183 | $('#codeoutput').addClass(lang); 184 | output.innerText = code; 185 | $('pre code').each(function(i, block) { 186 | hljs.highlightBlock(block); 187 | }); 188 | capitalizedLang = lang.charAt(0).toUpperCase() + lang.slice(1); 189 | document.title = 'Simplemark - ' + capitalizedLang + ' Document'; 190 | window.print(); 191 | if (typeof console !== "undefined" && console !== null) { 192 | console.log('Gist ' + gistid + ' loaded successfully.'); 193 | } 194 | }).error(function(e) { 195 | if (typeof console !== "undefined" && console !== null) { 196 | console.log('There was an error loading Gist ' + gistid); 197 | } 198 | }); 199 | } else { 200 | if (codeFileUpload.getAttribute("disabled") === "disabled" && codeGist.getAttribute("disabled") === "disabled") { 201 | code = document.getElementById('sourcecode').value; 202 | $('#all').hide(); 203 | $('#codepre').collapse('show'); 204 | if (lang !== null) { 205 | $('#codeoutput').addClass(lang); 206 | output.innerText = code; 207 | $('pre code').each(function(i, block) { 208 | hljs.highlightBlock(block); 209 | }); 210 | capitalizedLang = lang.charAt(0).toUpperCase() + lang.slice(1); 211 | document.title = 'Simplemark - ' + capitalizedLang + ' Document'; 212 | } else { 213 | output.innerText = code; 214 | $('pre code').each(function(i, block) { 215 | hljs.highlightBlock(block); 216 | }); 217 | document.title = 'Simplemark - Code Document'; 218 | window.print(); 219 | } 220 | } 221 | } 222 | } 223 | }; 224 | -------------------------------------------------------------------------------- /js/coffeescript/compiled/window.js: -------------------------------------------------------------------------------- 1 | // Generated by CoffeeScript 1.10.0 2 | var disabler, load, windowcontroller; 3 | 4 | windowcontroller = function(what) { 5 | switch (what) { 6 | case "lml": 7 | $("#lml-content").collapse("show"); 8 | return $("#code-content").collapse("hide"); 9 | case "code": 10 | $("#lml-content").collapse("hide"); 11 | return $("#code-content").collapse("show"); 12 | } 13 | }; 14 | 15 | load = function() { 16 | var currentIndex, langs, randomIndex, temporaryValue; 17 | loadparams(); 18 | Mousetrap.bind('s e x y', function() { 19 | return sexydown; 20 | }); 21 | langs = ["Markdown.", "Textile.", "C#.", "JavaScript.", "Perl.", "Java.", "Python.", "Ruby.", "Rust.", "R.", "PHP.", "HTML.", "CSS.", "Bash.", "CoffeeScript.", "SQL.", "Objective-C.", "C++.", "Apache.", "HTTP.", "JSON.", "FORTRAN.", "Processing.", "Brainf**k.", "Smalltalk.", "Cloqure.", "Dart.", "Go.", "VB.NET.", "Swift.", "Matlab.", "Haml.", "DOS .bat.", "Scala.", "Haskell.", "Lua.", "TeX.", "F#.", "Django.", "Lisp.", "AutoHotkey.", "LESS.", "SASS."]; 22 | currentIndex = langs.length; 23 | while (0 !== currentIndex) { 24 | randomIndex = Math.floor(Math.random() * currentIndex); 25 | currentIndex -= 1; 26 | temporaryValue = langs[currentIndex]; 27 | langs[currentIndex] = langs[randomIndex]; 28 | langs[randomIndex] = temporaryValue; 29 | } 30 | return $('#titlespan').typed({ 31 | strings: langs, 32 | typeSpeed: 0, 33 | startDelay: 3000, 34 | backSpeed: 0, 35 | backDelay: 3000, 36 | loop: true, 37 | loopCount: false, 38 | showCursor: true, 39 | cursorChar: '|' 40 | }); 41 | }; 42 | 43 | disabler = function(id1, id2, s) { 44 | var disable1, disable2, sender; 45 | disable1 = document.getElementById(id1); 46 | disable2 = document.getElementById(id2); 47 | sender = document.getElementById(s); 48 | if (sender.value !== '') { 49 | $(disable1).attr('disabled', 'disabled'); 50 | $(disable2).attr('disabled', 'disabled'); 51 | $(disable1).val(''); 52 | $(disable2).val(''); 53 | } else { 54 | $(disable1).removeAttr('disabled'); 55 | $(disable2).removeAttr('disabled'); 56 | } 57 | }; 58 | -------------------------------------------------------------------------------- /js/coffeescript/parameter.coffee: -------------------------------------------------------------------------------- 1 | # 2 | # the url parameter part 3 | # a file in the CoffeeScript port of Simplemark's JavaScript 4 | 5 | arrayQuery = -> 6 | # 'borrowed' from http://stackoverflow.com/questions/4297765/make-a-javascript-array-from-url 7 | url = window.location.href 8 | request = {} 9 | pairs = url.substring(url.indexOf('?') + 1).split('&') 10 | i = 0 11 | while i < pairs.length 12 | pair = pairs[i].split('=') 13 | request[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]) 14 | i++ 15 | request 16 | 17 | loadparams = -> 18 | query = arrayQuery() 19 | gfm = query['gfm'] 20 | # GitHub Flavored Markdown 21 | lists = query['sl'] 22 | # Smart Lists 23 | san = query['san'] 24 | # Sanitize 25 | pedant = query['ped'] 26 | # Pedantic Markdown 27 | sp = query['sp'] 28 | # Smartypants 29 | txt = query['txt'] 30 | # Textile 31 | fs = query['fs'] 32 | # Font size (pt) 33 | ff = query['ff'] 34 | # Font family 35 | val = decodeURIComponent(query['val']) 36 | # Text 37 | gistid = decodeURIComponent(query['gistid']) 38 | # Gist ID 39 | code = query['code'] 40 | # Code 41 | theme = query['theme'] 42 | # Code Theme 43 | ctheme = decodeURIComponent(query['ctheme']) 44 | # Custom theme URL 45 | # Set textbox to specified value 46 | if code != 'true' or code == undefined 47 | if query['val'] == undefined 48 | document.getElementById('ugly').value = '' 49 | else 50 | document.getElementById('ugly').value = val 51 | # Set textbox to Gist, if Gist ID is specified 52 | if query['gistid'] != undefined 53 | $.ajax( 54 | url: 'https://api.github.com/gists/' + gistid 55 | type: 'GET' 56 | dataType: 'jsonp').success((gistdata) -> 57 | names = Object.keys(gistdata.data.files) 58 | content = gistdata.data.files[names[0]].content 59 | document.getElementById('ugly').value = content 60 | console.log 'Gist ' + gistid + ' loaded successfully.' 61 | return 62 | ).error (e) -> 63 | console.log 'There was an error loading Gist ' + gistid 64 | return 65 | # Set GitHub Flavored Markdown 66 | if gfm == 'true' 67 | $('#gfm').attr 'checked', true 68 | else if gfm == 'false' 69 | $('#gfm').attr 'checked', false 70 | else 71 | $('#gfm').attr 'checked', true 72 | # Set Smart Lists 73 | if lists == 'true' 74 | $('#smartlists').attr 'checked', true 75 | else if lists == 'false' 76 | $('#smartlists').attr 'checked', false 77 | else 78 | $('#gfm').attr 'checked', true 79 | # Set Sanitize? 80 | if san == 'true' 81 | $('#sanitize').attr 'checked', true 82 | else 83 | $('#sanitize').attr 'checked', false 84 | # Set Pedantic Markdown 85 | if pedant == 'true' 86 | $('#pedantic').attr 'checked', true 87 | else 88 | $('#pedantic').attr 'checked', false 89 | # Set Smartypants 90 | if sp == 'true' 91 | $('#smartypants').attr 'checked', true 92 | else 93 | $('#smartypants').attr 'checked', false 94 | # Set Textile 95 | if txt == 'true' 96 | $('#txt').attr 'checked', true 97 | mddisable() 98 | else 99 | $('#txt').attr 'checked', false 100 | # Set Font Size 101 | if fs == null or fs == '' or fs == undefined 102 | document.getElementById('font-size').value = '12' 103 | else 104 | document.getElementById('font-size').value = fs 105 | # Set Font Family 106 | switch ff 107 | when 'lato' 108 | document.getElementById('font-family').selectedIndex = 0 109 | when 'gloria' 110 | document.getElementById('font-family').selectedIndex = 1 111 | when 'opensans' 112 | document.getElementById('font-family').selectedIndex = 2 113 | when 'merri' 114 | document.getElementById('font-family').selectedIndex = 3 115 | when 'incons' 116 | document.getElementById('font-family').selectedIndex = 4 117 | else 118 | document.getElementById('font-family').selectedIndex = 3 119 | break 120 | 'Done getting parameters.' 121 | else 122 | windowcontroller 'code' 123 | if query['val'] == undefined 124 | document.getElementById('sourcecode').value = '' 125 | else 126 | document.getElementById('sourcecode').value = val 127 | # Custom theme URL params 128 | if theme == undefined 129 | document.getElementById('theme').selectedIndex = 0 130 | else if theme == 4 131 | $('#custom').collapse 'show' 132 | document.getElementById('customlink').value = ctheme 133 | else if theme != undefined 134 | document.getElementById('theme').selectedIndex = theme 135 | # Set textbox to Gist, if Gist ID is specified 136 | if query['gistid'] != undefined 137 | $.ajax( 138 | url: 'https://api.github.com/gists/' + gistid 139 | type: 'GET' 140 | dataType: 'jsonp').success((gistdata) -> 141 | names = Object.keys(gistdata.data.files) 142 | content = gistdata.data.files[names[0]].content 143 | lang = gistdata.data.files[names[0]].language 144 | document.getElementById('sourcecode').value = content 145 | document.getElementById('lang').value = lang 146 | console.log 'Gist ' + gistid + ' loaded successfully.' 147 | return 148 | ).error (e) -> 149 | console.log 'There was an error loading Gist ' + gistid 150 | return 151 | 'Done getting parameters for code.' 152 | 153 | generateurl = -> 154 | font_size = document.getElementById('font-size').value 155 | font_family = document.getElementById('font-family').selectedIndex 156 | gfm = document.getElementById('gfm').checked.toString() 157 | sanitize = document.getElementById('sanitize').checked.toString() 158 | pedantic = document.getElementById('pedantic').checked.toString() 159 | smartypants = document.getElementById('smartypants').checked.toString() 160 | smartlists = document.getElementById('smartlists').checked.toString() 161 | txt = document.getElementById('txt').checked.toString() 162 | code = document.getElementById('code').checked.toString() 163 | # URL friendly! 164 | val = encodeURIComponent(document.getElementById('url-text').value) 165 | gist = encodeURIComponent(document.getElementById('gistid').value) 166 | # Code options 167 | theme = document.getElementById('theme').selectedIndex 168 | customlink = encodeURIComponent(document.getElementById('customlink').value) 169 | if code == 'false' 170 | ff = undefined 171 | switch font_family 172 | when 0 173 | ff = 'lato' 174 | when 1 175 | ff = 'gloria' 176 | when 2 177 | ff = 'opensans' 178 | when 3 179 | ff = 'merri' 180 | when 4 181 | ff = 'incons' 182 | link = 'https://soops.github.io/simplemark/?gfm=' + gfm + '&sl=' + smartlists + '&san=' + sanitize + '&ped=' + pedantic + '&sp=' + smartypants + '&txt=' + txt + '&fs=' + font_size + '&ff=' + ff + '&val=' + val + '&gistid=' + gist 183 | else 184 | if customlink == '' 185 | link = 'https://soops.github.io/simplemark/?code=' + code + '&val=' + val + '&gistid=' + gist + '&theme=' + theme 186 | else 187 | link = 'https://soops.github.io/simplemark/?code=' + code + '&val=' + val + '&gistid=' + gist + '&theme=4&ctheme=' + customlink 188 | document.getElementById('link').innerHTML = link 189 | $('#link').attr 'href', link 190 | return -------------------------------------------------------------------------------- /js/coffeescript/printer.coffee: -------------------------------------------------------------------------------- 1 | # 2 | # the markdown/code printer part 3 | # a file in the Coffeescript port of Simplemark's JavaScript 4 | # written by Ethan Arterberry in 2017, public domain under the Unlicense 5 | 6 | sexydown = -> 7 | $("#modedrop").fadeOut() 8 | uglyText = document.getElementById "ugly" 9 | mdGist = document.getElementById "md-gist" 10 | mdFileUpload = document.getElementById "md-fileupload" 11 | if mdGist.getAttribute("disabled") == "disabled" and uglyText.getAttribute("disabled") == "disabled" 12 | # Check for FileReader support 13 | if window.File and window.FileReader and window.FileList and window.Blob 14 | # Declare FileReader 15 | reader = new FileReader() 16 | reader.onload = -> 17 | console?.log "Opened file:\nContents:\n#{reader.result}" 18 | # Send reader result to sexydownPart2 19 | sexydownPart2 reader.result 20 | return 21 | 22 | # Call FileReader 23 | reader.readAsText mdFileUpload.files[0] 24 | return 25 | else 26 | alert "The file APIs are not supported by your browser." 27 | return 28 | if uglyText.getAttribute("disabled") == "disabled" and mdFileUpload.getAttribute("disabled") == "disabled" 29 | # Get Gist ID 30 | gistid = mdGist.value; 31 | $.ajax 32 | url: "https://api.github.com/gists/#{gistid}" 33 | type: "GET" 34 | dataType: "jsonp" 35 | success: (gistdata) -> 36 | # Do stuff on success 37 | names = Object.keys gistdata.data.files 38 | content = gistdata.data.files[names[0]].content 39 | console?.log "Gist #{gistid} loaded successfully." 40 | sexydownPart2 content 41 | return 42 | error: (e) -> 43 | # Throw error and specify Gist 44 | console?.log "Gist #{gistid} could not load. The following error was given:\n #{e}" 45 | return 46 | return 47 | if document.getElementById('md-fileupload').getAttribute('disabled') == 'disabled' and document.getElementById('md-gist').getAttribute('disabled') == 'disabled' 48 | disabler "md-fileupload", "md-gist", "ugly" 49 | sexydownPart2 $('#ugly').val() 50 | 51 | sexydownPart2 = (u) -> 52 | # Font settings: 53 | font_size = document.getElementById('font-size').value 54 | font_ms = document.getElementById('font-measure').selectedIndex 55 | font_family = document.getElementById('font-family').selectedIndex 56 | 57 | switch font_ms 58 | when 0 59 | measurement = "pt" 60 | when 1 61 | measurement = "px" 62 | when 2 63 | measurement = "rem" 64 | font_size = font_size + measurement; 65 | switch font_family 66 | when 0 67 | # Lato 68 | $("#cont").addClass "lato" 69 | when 1 70 | # Gloria 71 | $("#cont").addClass "gloria" 72 | when 2 73 | # Open Sans 74 | $("#cont").addClass "opensans" 75 | when 3 76 | # Merriweather 77 | $("#cont").addClass "merriweather" 78 | when 4 79 | # Inconsolata 80 | $("#cont").addClass "inconsolata" 81 | txt = document.getElementById("txt").checked 82 | if txt == true 83 | # Use Textile! 84 | s = textile u 85 | document.getElementById("cont").innerHTML = s 86 | window.setTimeout -> 87 | $("#cont > p").css "font-size", font_size 88 | window.print() 89 | return 90 | , 100 91 | else 92 | # Get Markdown options 93 | gfm = document.getElementById("gfm").checked; 94 | sanitize = document.getElementById("sanitize").checked; 95 | pedantic = document.getElementById("pedantic").checked; 96 | smartypants = document.getElementById("smartypants").checked; 97 | smartlists = document.getElementById("smartlists").checked; 98 | 99 | # Use Markdown! 100 | marked.setOptions 101 | renderer: new marked.Renderer() 102 | gfm: gfm 103 | tables: gfm 104 | breaks: gfm 105 | pedantic: pedantic 106 | sanitize: sanitize 107 | smartLists: smartlists 108 | smartypants: smartypants 109 | 110 | s = marked u 111 | document.getElementById("cont").innerHTML = s 112 | window.setTimeout -> 113 | $("#cont > p").css "font-size", font_size 114 | window.print() 115 | return 116 | , 100 117 | 118 | papercode = -> 119 | # Remove Bootstrap because it interferes 120 | $("link[title=bootstrap]")[0].remove() 121 | 122 | # Get options 123 | lang = document.getElementById('lang').value 124 | output = document.getElementById('codeoutput') 125 | style = document.getElementById('theme').selectedIndex 126 | 127 | switch style 128 | when 0 129 | $('.github, .xcode, .vs').remove() 130 | when 1 131 | $('.xcode, .vs, .googlecode').remove() 132 | when 2 133 | $('.github, .vs, .googlecode').remove() 134 | when 3 135 | $('.github, .xcode, .googlecode').remove() 136 | when 4 137 | $('.github, .xcode, .googlecode, .vs').remove() 138 | newelement = '' 139 | $('head').append newelement 140 | 141 | codeText = document.getElementById("sourcecode") 142 | codeGist = document.getElementById("gist") 143 | codeFileUpload = document.getElementById("fileupload") 144 | 145 | if codeText.getAttribute("disabled") == "disabled" and codeGist.getAttribute("disabled") == "disabled" 146 | # Check for FileReader support 147 | if window.File and window.FileReader and window.FileList and window.Blob 148 | # Declare FileReader 149 | reader = new FileReader() 150 | reader.onload = -> 151 | # Do code printing when the FileReader is called. 152 | $('#all').hide() 153 | $('#codepre').collapse 'show' 154 | console?.log 'Opened file.\nContents:\n' + reader.result 155 | # Define 'code' as the contents of the file. 156 | code = reader.result 157 | output.innerText = code 158 | $('pre code').each (i, block) -> 159 | hljs.highlightBlock block 160 | return 161 | document.title = 'Sexydown - Code Document' 162 | window.print() 163 | return 164 | 165 | # Call FileReader 166 | reader.readAsText codeFileUpload.files[0] 167 | return 168 | else 169 | alert "The file APIs are not supported by your browser." 170 | return 171 | else 172 | if codeText.getAttribute("disabled") == "disabled" and codeFileUpload.getAttribute("disabled") == "disabled" 173 | gistid = $('#gist').val() 174 | $.ajax( 175 | url: 'https://api.github.com/gists/' + gistid 176 | type: 'GET' 177 | dataType: 'jsonp').success((gistdata) -> 178 | # Hide everything and show code 179 | $('#all').hide() 180 | $('#codepre').collapse 'show' 181 | 182 | # Get Gist 183 | names = Object.keys(gistdata.data.files) 184 | code = gistdata.data.files[names[0]].content 185 | lang = gistdata.data.files[names[0]].language 186 | 187 | # Auto highlight from Gist language 188 | $('#codeoutput').addClass lang 189 | 190 | # Output and highlight 191 | output.innerText = code 192 | $('pre code').each (i, block) -> 193 | hljs.highlightBlock block 194 | return 195 | 196 | # Set window title 197 | capitalizedLang = lang.charAt(0).toUpperCase() + lang.slice(1) 198 | document.title = 'Simplemark - ' + capitalizedLang + ' Document' 199 | 200 | # Open print dialog 201 | window.print() 202 | console?.log 'Gist ' + gistid + ' loaded successfully.' 203 | return 204 | ).error (e) -> 205 | console?.log 'There was an error loading Gist ' + gistid 206 | return 207 | else 208 | if codeFileUpload.getAttribute("disabled") == "disabled" and codeGist.getAttribute("disabled") == "disabled" 209 | # Set code to textbox 210 | code = document.getElementById('sourcecode').value 211 | 212 | # Hide everything but the code 213 | $('#all').hide() 214 | $('#codepre').collapse 'show' 215 | 216 | # Check if language is set 217 | if lang != null 218 | # If language is set then just add the class specified and highlight the code 219 | $('#codeoutput').addClass lang 220 | output.innerText = code 221 | $('pre code').each (i, block) -> 222 | hljs.highlightBlock block 223 | return 224 | 225 | # Pretty window title 226 | capitalizedLang = lang.charAt(0).toUpperCase() + lang.slice(1) 227 | document.title = 'Simplemark - ' + capitalizedLang + ' Document' 228 | return 229 | else 230 | # Auto highlight based on automatic language chooser from highlight.js 231 | output.innerText = code 232 | $('pre code').each (i, block) -> 233 | hljs.highlightBlock block 234 | return 235 | document.title = 'Simplemark - Code Document' 236 | 237 | # Print! 238 | window.print() 239 | return -------------------------------------------------------------------------------- /js/coffeescript/window.coffee: -------------------------------------------------------------------------------- 1 | # 2 | # the window controls part 3 | # a file in the Coffeescript port of Simplemark's JavaScript 4 | # written by Ethan Arterberry in 2017, public domain under the Unlicense 5 | 6 | windowcontroller = (what) -> 7 | switch what 8 | when "lml" 9 | $("#lml-content").collapse "show" 10 | $("#code-content").collapse "hide" 11 | when "code" 12 | $("#lml-content").collapse "hide" 13 | $("#code-content").collapse "show" 14 | 15 | load = -> 16 | loadparams() 17 | Mousetrap.bind 's e x y', -> 18 | sexydown 19 | 20 | # Title shuffle 21 | langs = ["Markdown.", "Textile.", "C#.", "JavaScript.", "Perl.", "Java.", "Python.", "Ruby.", "Rust.", "R.", "PHP.", "HTML.", "CSS.", "Bash.", "CoffeeScript.", "SQL.", "Objective-C.", "C++.", "Apache.", "HTTP.", "JSON.", "FORTRAN.", "Processing.", "Brainf**k.", "Smalltalk.", "Cloqure.", "Dart.", "Go.", "VB.NET.", "Swift.", "Matlab.", "Haml.", "DOS .bat.", "Scala.", "Haskell.", "Lua.", "TeX.", "F#.", "Django.", "Lisp.", "AutoHotkey.", "LESS.", "SASS."] 22 | currentIndex = langs.length 23 | while 0 != currentIndex 24 | # Pick a remaining element... 25 | randomIndex = Math.floor(Math.random() * currentIndex) 26 | currentIndex -= 1 27 | # And swap it with the current element. 28 | temporaryValue = langs[currentIndex] 29 | langs[currentIndex] = langs[randomIndex] 30 | langs[randomIndex] = temporaryValue 31 | # Cursor and typing for title shuffle 32 | $('#titlespan').typed 33 | strings: langs 34 | typeSpeed: 0 35 | startDelay: 3000 36 | backSpeed: 0 37 | backDelay: 3000 38 | loop: true 39 | loopCount: false 40 | showCursor: true 41 | cursorChar: '|' 42 | 43 | disabler = (id1, id2, s) -> 44 | disable1 = document.getElementById(id1) 45 | disable2 = document.getElementById(id2) 46 | sender = document.getElementById(s) 47 | if sender.value != '' 48 | $(disable1).attr 'disabled', 'disabled' 49 | $(disable2).attr 'disabled', 'disabled' 50 | $(disable1).val '' 51 | $(disable2).val '' 52 | else 53 | $(disable1).removeAttr 'disabled' 54 | $(disable2).removeAttr 'disabled' 55 | return -------------------------------------------------------------------------------- /js/gistprint.js: -------------------------------------------------------------------------------- 1 | /* This is a bookmarklet that prints a Gist */ 2 | var url = window.location.href; 3 | var href = url.split( '/' ); 4 | var id = href[4]; 5 | console.log(id); 6 | window.location.href = "http://ethanarterberry.com/Sexydown/?gistid=" + id; 7 | 8 | /* Below this line is the compressed JavaScript ready to be put in a bookmarklet, just uncomment it 9 | 10 | javascript:(function()%7B%2F*%20This%20is%20a%20bookmarklet%20that%20prints%20a%20Gist%20*%2Fvar%20url%20%3D%20window.location.href%3Bvar%20href%20%3D%20url.split(%20'%2F'%20)%3Bvar%20id%20%3D%20href%5B4%5D%3Bconsole.log(id)%3Bwindow.location.href%20%3D%20%22http%3A%2F%2Fethanarterberry.com%2FSexydown%2F%3Fgistid%3D%22%20%2B%20id%7D)() 11 | 12 | */ -------------------------------------------------------------------------------- /js/parsers/marked.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * marked - a markdown parser 3 | * Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed) 4 | * https://github.com/chjj/marked 5 | */ 6 | (function(){var block={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:noop,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:noop,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/,def:/^ *\[([^\]]+)\]: *]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:noop,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};block.bullet=/(?:[*+-]|\d+\.)/;block.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;block.item=replace(block.item,"gm")(/bull/g,block.bullet)();block.list=replace(block.list)(/bull/g,block.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+block.def.source+")")();block.blockquote=replace(block.blockquote)("def",block.def)();block._tag="(?!(?:"+"a|em|strong|small|s|cite|q|dfn|abbr|data|time|code"+"|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo"+"|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b";block.html=replace(block.html)("comment",//)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/])*?>/)(/tag/g,block._tag)();block.paragraph=replace(block.paragraph)("hr",block.hr)("heading",block.heading)("lheading",block.lheading)("blockquote",block.blockquote)("tag","<"+block._tag)("def",block.def)();block.normal=merge({},block);block.gfm=merge({},block.normal,{fences:/^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,paragraph:/^/});block.gfm.paragraph=replace(block.paragraph)("(?!","(?!"+block.gfm.fences.source.replace("\\1","\\2")+"|"+block.list.source.replace("\\1","\\3")+"|")();block.tables=merge({},block.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/});function Lexer(options){this.tokens=[];this.tokens.links={};this.options=options||marked.defaults;this.rules=block.normal;if(this.options.gfm){if(this.options.tables){this.rules=block.tables}else{this.rules=block.gfm}}}Lexer.rules=block;Lexer.lex=function(src,options){var lexer=new Lexer(options);return lexer.lex(src)};Lexer.prototype.lex=function(src){src=src.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n");return this.token(src,true)};Lexer.prototype.token=function(src,top,bq){var src=src.replace(/^ +$/gm,""),next,loose,cap,bull,b,item,space,i,l;while(src){if(cap=this.rules.newline.exec(src)){src=src.substring(cap[0].length);if(cap[0].length>1){this.tokens.push({type:"space"})}}if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);cap=cap[0].replace(/^ {4}/gm,"");this.tokens.push({type:"code",text:!this.options.pedantic?cap.replace(/\n+$/,""):cap});continue}if(cap=this.rules.fences.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"code",lang:cap[2],text:cap[3]});continue}if(cap=this.rules.heading.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"heading",depth:cap[1].length,text:cap[2]});continue}if(top&&(cap=this.rules.nptable.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/\n$/,"").split("\n")};for(i=0;i ?/gm,"");this.token(cap,top,true);this.tokens.push({type:"blockquote_end"});continue}if(cap=this.rules.list.exec(src)){src=src.substring(cap[0].length);bull=cap[2];this.tokens.push({type:"list_start",ordered:bull.length>1});cap=cap[0].match(this.rules.item);next=false;l=cap.length;i=0;for(;i1&&b.length>1)){src=cap.slice(i+1).join("\n")+src;i=l-1}}loose=next||/\n\n(?!\s*$)/.test(item);if(i!==l-1){next=item.charAt(item.length-1)==="\n";if(!loose)loose=next}this.tokens.push({type:loose?"loose_item_start":"list_item_start"});this.token(item,false,bq);this.tokens.push({type:"list_item_end"})}this.tokens.push({type:"list_end"});continue}if(cap=this.rules.html.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:cap[1]==="pre"||cap[1]==="script"||cap[1]==="style",text:cap[0]});continue}if(!bq&&top&&(cap=this.rules.def.exec(src))){src=src.substring(cap[0].length);this.tokens.links[cap[1].toLowerCase()]={href:cap[2],title:cap[3]};continue}if(top&&(cap=this.rules.table.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/(?: *\| *)?\n$/,"").split("\n")};for(i=0;i])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:noop,tag:/^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:noop,text:/^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/;inline.link=replace(inline.link)("inside",inline._inside)("href",inline._href)();inline.reflink=replace(inline.reflink)("inside",inline._inside)();inline.normal=merge({},inline);inline.pedantic=merge({},inline.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/});inline.gfm=merge({},inline.normal,{escape:replace(inline.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:replace(inline.text)("]|","~]|")("|","|https?://|")()});inline.breaks=merge({},inline.gfm,{br:replace(inline.br)("{2,}","*")(),text:replace(inline.gfm.text)("{2,}","*")()});function InlineLexer(links,options){this.options=options||marked.defaults;this.links=links;this.rules=inline.normal;this.renderer=this.options.renderer||new Renderer;this.renderer.options=this.options;if(!this.links){throw new Error("Tokens array requires a `links` property.")}if(this.options.gfm){if(this.options.breaks){this.rules=inline.breaks}else{this.rules=inline.gfm}}else if(this.options.pedantic){this.rules=inline.pedantic}}InlineLexer.rules=inline;InlineLexer.output=function(src,links,options){var inline=new InlineLexer(links,options);return inline.output(src)};InlineLexer.prototype.output=function(src){var out="",link,text,href,cap;while(src){if(cap=this.rules.escape.exec(src)){src=src.substring(cap[0].length);out+=cap[1];continue}if(cap=this.rules.autolink.exec(src)){src=src.substring(cap[0].length);if(cap[2]==="@"){text=cap[1].charAt(6)===":"?this.mangle(cap[1].substring(7)):this.mangle(cap[1]);href=this.mangle("mailto:")+text}else{text=escape(cap[1]);href=text}out+=this.renderer.link(href,null,text);continue}if(!this.inLink&&(cap=this.rules.url.exec(src))){src=src.substring(cap[0].length);text=escape(cap[1]);href=text;out+=this.renderer.link(href,null,text);continue}if(cap=this.rules.tag.exec(src)){if(!this.inLink&&/^/i.test(cap[0])){this.inLink=false}src=src.substring(cap[0].length);out+=this.options.sanitize?escape(cap[0]):cap[0];continue}if(cap=this.rules.link.exec(src)){src=src.substring(cap[0].length);this.inLink=true;out+=this.outputLink(cap,{href:cap[2],title:cap[3]});this.inLink=false;continue}if((cap=this.rules.reflink.exec(src))||(cap=this.rules.nolink.exec(src))){src=src.substring(cap[0].length);link=(cap[2]||cap[1]).replace(/\s+/g," ");link=this.links[link.toLowerCase()];if(!link||!link.href){out+=cap[0].charAt(0);src=cap[0].substring(1)+src;continue}this.inLink=true;out+=this.outputLink(cap,link);this.inLink=false;continue}if(cap=this.rules.strong.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.strong(this.output(cap[2]||cap[1]));continue}if(cap=this.rules.em.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.em(this.output(cap[2]||cap[1]));continue}if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.codespan(escape(cap[2],true));continue}if(cap=this.rules.br.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.br();continue}if(cap=this.rules.del.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.del(this.output(cap[1]));continue}if(cap=this.rules.text.exec(src)){src=src.substring(cap[0].length);out+=escape(this.smartypants(cap[0]));continue}if(src){throw new Error("Infinite loop on byte: "+src.charCodeAt(0))}}return out};InlineLexer.prototype.outputLink=function(cap,link){var href=escape(link.href),title=link.title?escape(link.title):null;return cap[0].charAt(0)!=="!"?this.renderer.link(href,title,this.output(cap[1])):this.renderer.image(href,title,escape(cap[1]))};InlineLexer.prototype.smartypants=function(text){if(!this.options.smartypants)return text;return text.replace(/--/g,"—").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")};InlineLexer.prototype.mangle=function(text){var out="",l=text.length,i=0,ch;for(;i.5){ch="x"+ch.toString(16)}out+="&#"+ch+";"}return out};function Renderer(options){this.options=options||{}}Renderer.prototype.code=function(code,lang,escaped){if(this.options.highlight){var out=this.options.highlight(code,lang);if(out!=null&&out!==code){escaped=true;code=out}}if(!lang){return"
"+(escaped?code:escape(code,true))+"\n
"}return'
'+(escaped?code:escape(code,true))+"\n
\n"};Renderer.prototype.blockquote=function(quote){return"
\n"+quote+"
\n"};Renderer.prototype.html=function(html){return html};Renderer.prototype.heading=function(text,level,raw){return"'+text+"\n"};Renderer.prototype.hr=function(){return this.options.xhtml?"
\n":"
\n"};Renderer.prototype.list=function(body,ordered){var type=ordered?"ol":"ul";return"<"+type+">\n"+body+"\n"};Renderer.prototype.listitem=function(text){return"
  • "+text+"
  • \n"};Renderer.prototype.paragraph=function(text){return"

    "+text+"

    \n"};Renderer.prototype.table=function(header,body){return"\n"+"\n"+header+"\n"+"\n"+body+"\n"+"
    \n"};Renderer.prototype.tablerow=function(content){return"\n"+content+"\n"};Renderer.prototype.tablecell=function(content,flags){var type=flags.header?"th":"td";var tag=flags.align?"<"+type+' style="text-align:'+flags.align+'">':"<"+type+">";return tag+content+"\n"};Renderer.prototype.strong=function(text){return""+text+""};Renderer.prototype.em=function(text){return""+text+""};Renderer.prototype.codespan=function(text){return""+text+""};Renderer.prototype.br=function(){return this.options.xhtml?"
    ":"
    "};Renderer.prototype.del=function(text){return""+text+""};Renderer.prototype.link=function(href,title,text){if(this.options.sanitize){try{var prot=decodeURIComponent(unescape(href)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return""}if(prot.indexOf("javascript:")===0){return""}}var out='
    ";return out};Renderer.prototype.image=function(href,title,text){var out=''+text+'":">";return out};function Parser(options){this.tokens=[];this.token=null;this.options=options||marked.defaults;this.options.renderer=this.options.renderer||new Renderer;this.renderer=this.options.renderer;this.renderer.options=this.options}Parser.parse=function(src,options,renderer){var parser=new Parser(options,renderer);return parser.parse(src)};Parser.prototype.parse=function(src){this.inline=new InlineLexer(src.links,this.options,this.renderer);this.tokens=src.reverse();var out="";while(this.next()){out+=this.tok()}return out};Parser.prototype.next=function(){return this.token=this.tokens.pop()};Parser.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0};Parser.prototype.parseText=function(){var body=this.token.text;while(this.peek().type==="text"){body+="\n"+this.next().text}return this.inline.output(body)};Parser.prototype.tok=function(){switch(this.token.type){case"space":{return""}case"hr":{return this.renderer.hr()}case"heading":{return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text)}case"code":{return this.renderer.code(this.token.text,this.token.lang,this.token.escaped)}case"table":{var header="",body="",i,row,cell,flags,j;cell="";for(i=0;i/g,">").replace(/"/g,""").replace(/'/g,"'")}function unescape(html){return html.replace(/&([#\w]+);/g,function(_,n){n=n.toLowerCase();if(n==="colon")return":";if(n.charAt(0)==="#"){return n.charAt(1)==="x"?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1))}return""})}function replace(regex,opt){regex=regex.source;opt=opt||"";return function self(name,val){if(!name)return new RegExp(regex,opt);val=val.source||val;val=val.replace(/(^|[^\[])\^/g,"$1");regex=regex.replace(name,val);return self}}function noop(){}noop.exec=noop;function merge(obj){var i=1,target,key;for(;iAn error occured:

    "+escape(e.message+"",true)+"
    "}throw e}}marked.options=marked.setOptions=function(opt){merge(marked.defaults,opt);return marked};marked.defaults={gfm:true,tables:true,breaks:false,pedantic:false,sanitize:false,smartLists:false,silent:false,highlight:null,langPrefix:"lang-",smartypants:false,headerPrefix:"",renderer:new Renderer,xhtml:false};marked.Parser=Parser;marked.parser=Parser.parse;marked.Renderer=Renderer;marked.Lexer=Lexer;marked.lexer=Lexer.lex;marked.InlineLexer=InlineLexer;marked.inlineLexer=InlineLexer.output;marked.parse=marked;if(typeof module!=="undefined"&&typeof exports==="object"){module.exports=marked}else if(typeof define==="function"&&define.amd){define(function(){return marked})}else{this.marked=marked}}).call(function(){return this||(typeof window!=="undefined"?window:global)}()); -------------------------------------------------------------------------------- /js/parsers/textile.min.js: -------------------------------------------------------------------------------- 1 | (function(){"use strict";var re={_cache:{},pattern:{punct:"[!-/:-@\\[\\\\\\]-`{-~]",space:"\\s"},escape:function(src){return src.replace(/[\-\[\]\{\}\(\)\*\+\?\.\,\\\^\$\|\#\s]/g,"\\$&")},collapse:function(src){return src.replace(/(?:#.*?(?:\n|$))/g,"").replace(/\s+/g,"")},expand_patterns:function(src){return src.replace(/\[\:\s*(\w+)\s*\:\]/g,function(m,k){return k in re.pattern?re.expand_patterns(re.pattern[k]):k})},isRegExp:function(r){return Object.prototype.toString.call(r)==="[object RegExp]"},compile:function(src,flags){if(re.isRegExp(src)){if(arguments.length===1){flags=(src.global?"g":"")+(src.ignoreCase?"i":"")+(src.multiline?"m":"")}src=src.source}var ckey=src+(flags||"");if(ckey in re._cache){return re._cache[ckey]}var rx=re.expand_patterns(src);if(flags&&/x/.test(flags)){rx=re.collapse(rx)}if(flags&&/s/.test(flags)){rx=rx.replace(/([^\\])\./g,"$1[^\\0]")}flags=(flags||"").replace(/[^gim]/g,"");return re._cache[ckey]=new RegExp(rx,flags)}};var JSONML={escape:function(text,esc_quotes){return text.replace(/&(?!(#\d{2,}|#x[\da-fA-F]{2,}|[a-zA-Z][a-zA-Z1-4]{1,6});)/g,"&").replace(//g,">").replace(/"/g,esc_quotes?""":'"').replace(/'/g,esc_quotes?"'":"'")},toHTML:function(jsonml){jsonml=jsonml.concat();if(typeof jsonml==="string"){return JSONML.escape(jsonml)}var tag=jsonml.shift(),attributes={},content=[],tag_attrs="",a;if(jsonml.length&&typeof jsonml[0]==="object"&&!_isArray(jsonml[0])){attributes=jsonml.shift()}while(jsonml.length){content.push(JSONML.toHTML(jsonml.shift()))}for(a in attributes){tag_attrs+=attributes[a]==null?" "+a:" "+a+'="'+JSONML.escape(attributes[a],true)+'"'}if(tag=="!"){return""}else if(tag==="img"||tag==="br"||tag==="hr"||tag==="input"){return"<"+tag+tag_attrs+" />"}else{return"<"+tag+tag_attrs+">"+content.join("")+""}}};function merge(a,b){for(var k in b){a[k]=b[k]}return a}var _isArray=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"};re.pattern["blocks"]="(?:b[qc]|div|notextile|pre|h[1-6]|fn\\d+|p|###)";re.pattern["pba_class"]="\\([^\\)]+\\)";re.pattern["pba_style"]="\\{[^\\}]+\\}";re.pattern["pba_lang"]="\\[[^\\[\\]]+\\]";re.pattern["pba_align"]="(?:<>|<|>|=)";re.pattern["pba_pad"]="[\\(\\)]+";re.pattern["pba_attr"]="(?:[:pba_class:]|[:pba_style:]|[:pba_lang:]|[:pba_align:]|[:pba_pad:])*";re.pattern["url_punct"]="[.,«»″‹›!?]";re.pattern["html_id"]="[a-zA-Z][a-zA-Z\\d:]*";re.pattern["html_attr"]="(?:\"[^\"]+\"|'[^']+'|[^>\\s]+)";re.pattern["tx_urlch"]='[\\w"$\\-_.+!*\'(),";\\/?:@=&%#{}|\\\\^~\\[\\]`]';re.pattern["tx_cite"]=":((?:[^\\s()]|\\([^\\s()]+\\)|[()])+?)(?=[!-\\.:-@\\[\\\\\\]-`{-~]+(?:$|\\s)|$|\\s)";re.pattern["ucaps"]="A-Z"+"À-ÖØ-Þ"+"ĀĂĄĆĈĊČĎĐĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮİIJĴĶĹĻĽĿ"+"ŁŃŅŇŊŌŎŐŒŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŸŹŻŽ"+"ƁƂƄƆƇƉ-ƋƎ-ƑƓƔƖ-ƘƜƝƟƠƢƤƦƧƩƬƮƯƱ-ƳƵƷƸƼ"+"DŽLJNJǍǏǑǓǕǗǙǛǞǠǢǤǦǨǪǬǮDZǴǶ-ǸǺǼǾ"+"ȀȂȄȆȈȊȌȎȐȒȔȖȘȚȜȞȠȢȤȦȨȪȬȮȰȲȺȻȽȾ"+"ɁɃ-ɆɈɊɌɎ"+"ḀḂḄḆḈḊḌḎḐḒḔḖḘḚḜḞḠḢḤḦḨḪḬḮḰḲḴḶḸḺḼḾṀ"+"ṂṄṆṈṊṌṎṐṒṔṖṘṚṜṞṠṢṤṦṨṪṬṮṰṲṴṶṸṺṼṾ"+"ẀẂẄẆẈẊẌẎẐẒẔẞẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼẾ"+"ỀỂỄỆỈỊỌỎỐỒỔỖỘỚỜỞỠỢỤỦỨỪỬỮỰỲỴỶỸỺỼỾ"+"ⱠⱢ-ⱤⱧⱩⱫⱭ-ⱰⱲⱵⱾⱿ"+"ꜢꜤꜦꜨꜪꜬꜮꜲꜴꜶꜸꜺꜼꜾ"+"ꝀꝂꝄꝆꝈꝊꝌꝎꝐꝒꝔꝖꝘꝚꝜꝞꝠꝢꝤꝦꝨꝪꝬꝮꝹꝻꝽꝾ"+"ꞀꞂꞄꞆꞋꞍꞐꞒꞠꞢꞤꞦꞨꞪ";var re_block=re.compile(/^([:blocks:])/),re_block_se=re.compile(/^[:blocks:]$/),re_block_normal=re.compile(/^(.*?)($|\n(?:\s*\n|$)+)/,"s"),re_block_extended=re.compile(/^(.*?)($|\n+(?=[:blocks:][:pba_attr:]\.))/,"s"),re_ruler=/^(\-\-\-+|\*\*\*+|___+)(\n\s+|$)/,re_list=re.compile(/^((?:[\t ]*[\#\*]+[:pba_attr:] .+?(?:\n|$))+)(\s*\n)?/),re_list_item=/^([\#\*]+)(.+?)(\n|$)/,re_table=re.compile(/^((?:table[:pba_attr:]\.\n)?(?:(?:[:pba_attr:]\.[^\n\S]*)?\|.*?\|[^\n\S]*(?:\n|$))+)([^\n\S]*\n)?/,"s"),re_table_head=/^table(_?)([^\n]+)\.\s?\n/,re_table_row=re.compile(/^([:pba_attr:]\.[^\n\S]*)?\|(.*?)\|[^\n\S]*(\n|$)/,"s"),re_fenced_phrase=/^\[(__?|\*\*?|\?\?|[\-\+\^~@%])([^\n]+)\1\]/,re_phrase=/^([\[\{]?)(__?|\*\*?|\?\?|[\-\+\^~@%])/,re_text=re.compile(/^.+?(?=[\\(\n*)/),re_html_tag=re.compile(/^<([:html_id:])((?:\s[^=\s\/]+(?:\s*=\s*[:html_attr:])?)+)?\s*(\/?)>(\n*)/),re_html_comment=re.compile(/^/,"s"),re_html_end_tag=re.compile(/^<\/([:html_id:])([^>]*)>/),re_html_attr=re.compile(/^\s*([^=\s]+)(?:\s*=\s*("[^"]+"|'[^']+'|[^>\s]+))?/),re_entity=/&(#\d\d{2,}|#x[\da-fA-F]{2,}|[a-zA-Z][a-zA-Z1-4]{1,6});/,re_dimsign=/([\d\.,]+['"]? ?)x( ?)(?=[\d\.,]['"]?)/g,re_emdash=/(^|[\s\w])--([\s\w]|$)/g,re_trademark=/(\b ?|\s|^)(?:\((?:TM|tm)\)|\[(?:TM|tm)\])/g,re_registered=/(\b ?|\s|^)(?:\(R\)|\[R\])/gi,re_copyright=/(\b ?|\s|^)(?:\(C\)|\[C\])/gi,re_apostrophe=/(\w)\'(\w)/g,re_double_prime=re.compile(/(\d*[\.,]?\d+)"(?=\s|$|[:punct:])/g),re_single_prime=re.compile(/(\d*[\.,]?\d+)'(?=\s|$|[:punct:])/g),re_closing_dquote=re.compile(/([^\s\[\(])"(?=$|\s|[:punct:])/g),re_closing_squote=re.compile(/([^\s\[\(])'(?=$|\s|[:punct:])/g),re_pba_classid=/^\(([^\(\)\n]+)\)/,re_pba_padding_l=/^([\(]+)/,re_pba_padding_r=/^([\)]+)/,re_pba_align_blk=/^(<>|<|>|=)/,re_pba_align_img=/^(<|>|=)/,re_pba_valign=/^(~|\^|\-)/,re_pba_colspan=/^\\(\d+)/,re_pba_rowspan=/^\/(\d+)/,re_pba_styles=/^\{([^\}]*)\}/,re_pba_css=/^\s*([^:\s]+)\s*:\s*(.+)\s*$/,re_pba_lang=/^\[([^\[\]]+)\]/;var phrase_convert={"*":"strong","**":"b","??":"cite",_:"em",__:"i","-":"del","%":"span","+":"ins","~":"sub","^":"sup","@":"code"};var html_singletons={br:1,hr:1,img:1,link:1,meta:1,wbr:1,area:1,param:1,input:1,option:1,base:1};var pba_align_lookup={"<":"left","=":"center",">":"right","<>":"justify"};var pba_valign_lookup={"~":"bottom","^":"top","-":"middle"};var allowed_blocktags={p:0,hr:0,ul:1,ol:0,li:0,div:1,pre:0,object:1,script:0,noscript:0,blockquote:1,notextile:1};function ribbon(feed){var _slot=null,org=feed+"",pos=0;return{save:function(){_slot=pos},load:function(){pos=_slot;feed=org.slice(pos)},advance:function(n){pos+=typeof n==="string"?n.length:n;return feed=org.slice(pos)},lookbehind:function(nchars){nchars=nchars==null?1:nchars;return org.slice(pos-nchars,pos)},startsWith:function(s){return feed.substring(0,s.length)===s},valueOf:function(){return feed},toString:function(){return feed}}}function builder(arr){var _arr=_isArray(arr)?arr:[];return{add:function(node){if(typeof node==="string"&&typeof _arr[_arr.length-1]==="string"){_arr[_arr.length-1]+=node}else if(_isArray(node)){var f=node.filter(function(s){return s!==undefined});_arr.push(f)}else if(node){_arr.push(node)}return this},merge:function(s){for(var i=0,l=s.length;i=0;i--){var head=_stack[i];if(head[0]===tag){_stack.splice(i);list=_stack[_stack.length-1]||root;break}}}src.advance(m[0])}else if((m=re_html_tag.exec(src))&&oktag(m[1])){src.advance(m[0]);tag=m[1];var single=m[3]||m[1]in html_singletons,tail=m[4],element=[tag];if(m[2]){element.push(parse_html_attr(m[2]))}if(single){list.push(element);if(tail){list.push(tail)}}else{if(tail){element.push(tail)}_stack.push(element);list.push(element);list=element}}else{m=/([^<]+|[^\0])/.exec(src);if(m){list.push(m[0])}src.advance(m?m[0].length||1:1)}}while(src.valueOf());return root}function parse_attr(input,element,end_token){input+="";if(!input||element==="notextile"){return undefined}var m,st={},o={style:st},remaining=input,is_block=element==="table"||element==="td"||re_block_se.test(element),is_img=element==="img",is_phrase=!is_block&&!is_img&&element!=="a",re_pba_align=is_img?re_pba_align_img:re_pba_align_blk;do{if(m=re_pba_styles.exec(remaining)){m[1].split(";").forEach(function(p){var d=p.match(re_pba_css);if(d){st[d[1]]=d[2]}});remaining=remaining.slice(m[0].length);continue}if(m=re_pba_lang.exec(remaining)){o["lang"]=m[1];remaining=remaining.slice(m[0].length);continue}if(m=re_pba_classid.exec(remaining)){var rm=remaining.slice(m[0].length);if(!rm&&is_phrase||end_token&&(rm[0]===" "||end_token===rm.slice(0,end_token.length))){m=null;continue}var bits=m[1].split("#");if(bits[0]){o["class"]=bits[0]}if(bits[1]){o["id"]=bits[1]}remaining=rm;continue}if(is_block){if(m=re_pba_padding_l.exec(remaining)){st["padding-left"]=m[1].length+"em";remaining=remaining.slice(m[0].length);continue}if(m=re_pba_padding_r.exec(remaining)){st["padding-right"]=m[1].length+"em";remaining=remaining.slice(m[0].length);continue}}if(is_img||is_block){if(m=re_pba_align.exec(remaining)){var align=pba_align_lookup[m[1]];if(is_img){o["align"]=align}else{st["text-align"]=align}remaining=remaining.slice(m[0].length);continue}}if(element==="td"||element==="tr"){if(m=re_pba_valign.exec(remaining)){st["vertical-align"]=pba_valign_lookup[m[1]];remaining=remaining.slice(m[0].length);continue}}if(element==="td"){if(m=re_pba_colspan.exec(remaining)){o["colspan"]=m[1];remaining=remaining.slice(m[0].length);continue}if(m=re_pba_rowspan.exec(remaining)){o["rowspan"]=m[1];remaining=remaining.slice(m[0].length);continue}}}while(m);var s=[];for(var v in st){s.push(v+":"+st[v])}if(s.length){o.style=s.join(";")}else{delete o.style}return remaining==input?undefined:[input.length-remaining.length,o]}function parse_glyphs(src){if(typeof src!=="string"){return src}return src.replace(/([^\-]|^)->/,"$1→").replace(re_dimsign,"$1×$2").replace(/([^.]?)\.{3}/g,"$1…").replace(re_emdash,"$1—$2").replace(/( )-( )/g,"$1–$2").replace(re_trademark,"$1™").replace(re_registered,"$1®").replace(re_copyright,"$1©").replace(re_double_prime,"$1″").replace(re_closing_dquote,"$1”").replace(/"/g,"“").replace(re_single_prime,"$1′").replace(re_apostrophe,"$1’$2").replace(re_closing_squote,"$1’").replace(/'/g,"‘")}function parse_list(src,options){src=ribbon(src.replace(/(^|\n)[\t ]+/,"$1"));var pad=function(n){var s="\n";while(n--){s+=" "}return s},stack=[],m,s;while(m=re_list_item.exec(src)){var item=["li"],pba=parse_attr(m[2],"li");if(pba){m[2]=m[2].slice(pba[0]);pba=pba[1]}var dest_level=m[1].length,type=m[1].substr(-1)==="#"?"ol":"ul",eqlev=stack.length===dest_level,new_li=null,lst,par,r;while(stack.lengthdest_level){r=stack.pop();r.ul.push(pad(stack.length))}par=stack[stack.length-1];if(!new_li){par.ul.push(pad(stack.length),item);par.li=item}if(pba){par.li.push(pba)}Array.prototype.push.apply(par.li,parse_inline(m[2].trim(),options));src.advance(m[0])}while(stack.length){s=stack.pop();s.ul.push(pad(stack.length))}return s.ul}function parse_table(src,options){src=ribbon(src.trim());var table=["table"],row,inner,pba,more,m;if(m=re_table_head.exec(src)){src.advance(m[0]);pba=parse_attr(m[2],"table");if(pba){table.push(pba[1])}}while(m=re_table_row.exec(src)){row=["tr"];if(m[1]&&(pba=parse_attr(m[1],"tr"))){row.push(pba[1])}table.push("\n ",row);inner=ribbon(m[2]);do{inner.save();var th=inner.startsWith("_"),cell=[th?"th":"td"];if(th){inner.advance(1)}pba=parse_attr(inner,"td");if(pba){inner.advance(pba[0]);cell.push(pba[1])}if(pba||th){var d=/^\.\s*/.exec(inner);if(d){inner.advance(d[0])}else{cell=["td"];inner.load()}}var mx=/^(==.*?==|[^\|])*/.exec(inner);cell=cell.concat(parse_inline(mx[0],options));row.push("\n ",cell);more=inner.valueOf().charAt(mx[0].length)==="|";inner.advance(mx[0].length+1)}while(more);row.push("\n ");src.advance(m[0])}table.push("\n");return table}function parse_inline(src,options){src=ribbon(src);var list=builder(),m,pba;do{src.save();if(src.startsWith("\n")){src.advance(1);if(options.breaks){list.add(["br"])}list.add("\n");continue}if(m=/^==(.*?)==/.exec(src)){src.advance(m[0]);list.add(m[1]);continue}var behind=src.lookbehind(1);var boundary=!behind||/^[\s>.,"'?!;:()]$/.test(behind);if((m=re_phrase.exec(src))&&(boundary||m[1])){src.advance(m[0]);var tok=m[2],fence=m[1],phrase_type=phrase_convert[tok],code=phrase_type==="code";if(pba=!code&&parse_attr(src,phrase_type,tok)){src.advance(pba[0]);pba=pba[1]}var m_mid;var m_end;if(fence==="["){m_mid="^(.*?)";m_end="(?:])"}else if(fence==="{"){m_mid="^(.*?)";m_end="(?:})"}else{var t1=re.escape(tok.charAt(0));m_mid=code?"^(\\S+|\\S+.*?\\S)":"^([^\\s"+t1+"]+|[^\\s"+t1+"].*?\\S("+t1+"*))";m_end="(?=$|[\\s.,\"'!?;:()«»„“”‚‘’])"}var rx=re.compile(m_mid+"("+re.escape(tok)+")"+m_end);if((m=rx.exec(src))&&m[1]){src.advance(m[0]);if(code){list.add([phrase_type,m[1]])}else{list.add([phrase_type,pba].concat(parse_inline(m[1],options)))}continue}src.load()}if((m=re_image.exec(src))||(m=re_image_fenced.exec(src))){src.advance(m[0]);pba=m[1]&&parse_attr(m[1],"img");var attr=pba?pba[1]:{src:""},img=["img",attr];attr.src=m[2];attr.alt=m[3]?attr.title=m[3]:"";if(m[4]){img=["a",{href:m[4]},img]}list.add(img);continue}if(m=re_html_comment.exec(src)){src.advance(m[0]);list.add(["!",m[1]]);continue}if(m=re_html_tag.exec(src)){src.advance(m[0]);var tag=m[1],single=m[3]||m[1]in html_singletons,element=[tag],tail=m[4];if(m[2]){element.push(parse_html_attr(m[2]))}if(single){list.add(element).add(tail);continue}else{var re_end_tag=re.compile("^(.*?)()","s");if(m=re_end_tag.exec(src)){src.advance(m[0]);if(tag==="code"){element.push(tail,m[1])}else if(tag==="notextile"){list.merge(parse_inline(m[1],options));continue}else{element=element.concat(parse_inline(m[1],options))}list.add(element);continue}}src.load()}if(m=re_footnote.exec(src)){src.advance(m[0]);list.add(["sup",{"class":"footnote",id:"fnr"+m[1]},["a",{href:"#fn"+m[1]},m[1]]]);continue}if(m=re_caps.exec(src)){src.advance(m[0]);var caps=["span",{"class":"caps"},m[1]];if(m[2]){caps=["acronym",{title:m[2]},caps]}list.add(caps);continue}if(boundary&&(m=re_link.exec(src))||(m=re_link_fenced.exec(src))){src.advance(m[0].length);var title=m[1].match(re_link_title),inner=title?m[1].slice(0,m[1].length-title[0].length):m[1];if(pba=parse_attr(inner,"a")){inner=inner.slice(pba[0]);pba=pba[1]}else{pba={}}if(title&&!inner){inner=title[0];title=""}pba.href=m[2];if(title){pba.title=title[1]}list.add(["a",pba].concat(parse_inline(inner.replace(/^(\.?\s*)/,""),options)));continue}m=/([a-zA-Z0-9,.':]+|\s+|[^\0])/.exec(src);if(m){list.add(m[0])}src.advance(m?m[0].length||1:1)}while(src.valueOf());return list.get().map(parse_glyphs)}function parse_blocks(src,options){var list=builder(),paragraph=function(s,tag,pba,linebreak){tag=tag||"p";var out=[];s.split(/\n\n+/).forEach(function(bit,i){if(tag==="p"&&/^\s/.test(bit)){bit=bit.replace(/\n[\t ]/g," ").trim();out=out.concat(parse_inline(bit,options))}else{if(linebreak&&i){out.push(linebreak)}out.push(pba?[tag,pba].concat(parse_inline(bit,options)):[tag].concat(parse_inline(bit,options)))}});return out},link_refs={},m;src=ribbon(src.replace(/^( *\n)+/,""));while(src.valueOf()){src.save();if(m=re_link_ref.exec(src)){src.advance(m[0]);link_refs[m[1]]=m[2];continue}list.linebreak();if(m=re_block.exec(src)){src.advance(m[0]);var block_type=m[0],pba=parse_attr(src,block_type);if(pba){src.advance(pba[0]);pba=pba[1]}if(m=/^\.(\.?)(?:\s|(?=:))/.exec(src)){var extended=!!m[1];m=(extended?re_block_extended:re_block_normal).exec(src.advance(m[0]));src.advance(m[0]);if(block_type==="bq"){var cite,inner=m[1];if(m=/^:(\S+)\s+/.exec(inner)){if(!pba){pba={}}pba.cite=m[1];inner=inner.slice(m[0].length)}list.add(["blockquote",pba,"\n"].concat(paragraph(inner,"p",copy_pba(pba,{cite:1,id:1}),"\n")).concat(["\n"]))}else if(block_type==="bc"){var sub_pba=pba?copy_pba(pba,{id:1}):null;list.add(["pre",pba,sub_pba?["code",sub_pba,m[1]]:["code",m[1]]])}else if(block_type==="notextile"){list.merge(parse_html(m[1]))}else if(block_type==="###"){}else if(block_type==="pre"){list.add(["pre",pba,m[1]])}else if(re_footnote_def.test(block_type)){var fnid=block_type.replace(/\D+/g,"");if(!pba){pba={}}pba["class"]=(pba["class"]?pba["class"]+" ":"")+"footnote";pba["id"]="fn"+fnid;list.add(["p",pba,["a",{href:"#fnr"+fnid},["sup",fnid]]," "].concat(parse_inline(m[1],options)))}else{list.merge(paragraph(m[1],block_type,pba,"\n"))}continue}else{src.load()}}if(m=re_html_comment.exec(src)){src.advance(m[0]+(/(?:\s*\n+)+/.exec(src)||[])[0]);list.add(["!",m[1]]);continue}if(m=re_html_tag_block.exec(src)){var tag=m[1],single=m[3]||tag in html_singletons,tail=m[4];if(tag in allowed_blocktags){src.advance(m[0]);var element=[tag];if(m[2]){element.push(parse_html_attr(m[2]))}if(single){list.add(element);continue}else{var re_end_tag=re.compile("^(.*?)(\\s*)()(\\s*)","s");if(m=re_end_tag.exec(src)){src.advance(m[0]);if(tag==="pre"){element.push(tail);element=element.concat(parse_html(m[1].replace(/\n+$/,""),{code:1}));if(m[2]){element.push(m[2])}list.add(element)}else if(tag==="notextile"){element=parse_html(m[1].trim());list.merge(element)}else if(tag==="script"||tag==="noscript"){element.push(tail+m[1]);list.add(element)}else{if(/\n/.test(tail)){element.push("\n")}if(/\n/.test(m[1])){element=element.concat(parse_blocks(m[1],options))}else{element=element.concat(parse_inline(m[1].replace(/^ +/,""),options))}if(/\n/.test(m[2])){element.push("\n")}list.add(element)}continue}}}src.load()}if(m=re_ruler.exec(src)){src.advance(m[0]);list.add(["hr"]);continue}if(m=re_list.exec(src)){src.advance(m[0]);list.add(parse_list(m[0],options));continue}if(m=re_table.exec(src)){src.advance(m[0]);list.add(parse_table(m[1],options));continue}m=re_block_normal.exec(src);list.merge(paragraph(m[1],"p",undefined,"\n"));src.advance(m[0])}return list.get().map(fix_links,link_refs)}function fix_links(jsonml){if(_isArray(jsonml)){if(jsonml[0]==="a"){var attr=jsonml[1];if(typeof attr==="object"&&"href"in attr&&attr.href in this){attr.href=this[attr.href]}}for(var i=1,l=jsonml.length;i 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Simplemark 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 |
    65 |
    66 |
    67 |

    Simplemark: A simple way to print Markdown.

    68 |

    69 |

    Simplemark is a useful, completely public domain, free website that prints code beautifully minimalistic on paper. It can compile Markdown and Textile markup to HTML and print it with a variety of options, and it can print 118 languages in beautifully syntax-highlighted glory on paper. Better yet, you can create a custom URL using the URL generator that will check the options for you. Simplemark has many new features that make it a fully-featured printing utility belt that you'll keep in your bookmarks for all eternity. If you're a nerd, you will be pleased to hear that Simplemark is public domain on GitHub.

    70 |

    URL Generator: Create a custom URL with options built in for speed.

    71 |
    72 |
    73 |   Code printing? 74 |
    75 |
    76 | 77 |
    78 | 85 |
    86 |
    87 | 88 |
    89 | 90 |
    91 |
    92 |
    93 | 94 |
    95 | 96 | 97 |
    98 |
    99 |

    Markdown Options:

    100 |   Enable GitHub Flavored Markdown? 101 |
    102 |   Enable smart lists? 103 |
    104 |   Sanitize Markdown code (ignore anything other than Markdown code)? 105 |
    106 |   Use pedantic Markdown? 107 |
    108 |   Enable SmartyPants (use 'smart' quotes and dashes)? 109 |
    110 |
    111 |
    112 |
    113 |

    Other Options:

    114 |   Enable Textile? 115 |
    116 | Font size:   117 |   118 | 123 |
    124 | Font family:   125 | 132 |
    133 |
    134 | 135 |
    136 |
    137 |

    Your URL is:

    138 |
    http://soops.github.io/simplemark/?
    139 |
    140 |
    141 | 162 | 163 | 164 | --------------------------------------------------------------------------------