diff --git a/.gitattributes b/.gitattributes
index 7e29a2c..6234bf3 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,7 +1,6 @@
/test export-ignore
.gitattributes export-ignore
.gitignore export-ignore
-/perlMarkdown export-ignore
-/example export-ignore
-grunt.js export-ignore
-
+.jshintignore export-ignore
+.travis.yml export-ignore
+Gruntfile.js export-ignore
diff --git a/.gitignore b/.gitignore
index 8d7c6bb..61f9328 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
+.idea/
+build/
.DS_Store
node_modules
npm-debug.log
-.idea/
diff --git a/.jshintignore b/.jshintignore
index 62aa808..a76422d 100644
--- a/.jshintignore
+++ b/.jshintignore
@@ -1,2 +1,3 @@
Gruntfile.js
-dist/**/*.js
\ No newline at end of file
+dist/**/*.js
+build/**/*.js
diff --git a/.jshintrc b/.jshintrc
new file mode 100644
index 0000000..03d5961
--- /dev/null
+++ b/.jshintrc
@@ -0,0 +1,27 @@
+{
+ "node": true,
+ "browser": true,
+ "esnext": true,
+ "bitwise": true,
+ "camelcase": true,
+ "curly": true,
+ "eqeqeq": true,
+ "immed": true,
+ "indent": 2,
+ "latedef": "nofunc",
+ "newcap": true,
+ "noarg": true,
+ "quotmark": "single",
+ "undef": false,
+ "unused": true,
+ "strict": false,
+ "trailing": true,
+ "smarttabs": true,
+ "globals": {
+ "angular": true,
+ "module": true,
+ "define": true,
+ "window": true,
+ "showdown": true
+ }
+}
diff --git a/CREDITS.md b/CREDITS.md
new file mode 100644
index 0000000..632bca4
--- /dev/null
+++ b/CREDITS.md
@@ -0,0 +1,39 @@
+Credits
+=======
+ - Showdown v2
+ * [Estevão Santos](http://soares-dos-santos.com)
+ Code Refactoring and project maintainer
+
+ - Showdown v1
+ * [Corey Innis](http://github.com/coreyti):
+ GitHub project maintainer
+ * [Remy Sharp](https://github.com/remy/):
+ CommonJS-compatibility and more
+ * [Konstantin Käfer](https://github.com/kkaefer/):
+ CommonJS packaging
+ * [Roger Braun](https://github.com/rogerbraun):
+ Github-style code blocks
+ * [Dominic Tarr](https://github.com/dominictarr):
+ Documentation
+ * [Cat Chen](https://github.com/CatChen):
+ Export fix
+ * [Titus Stone](https://github.com/tstone):
+ Mocha tests, extension mechanism, and bug fixes
+ * [Rob Sutherland](https://github.com/roberocity):
+ The idea that lead to extensions
+ * [Pavel Lang](https://github.com/langpavel):
+ Code cleanup
+ * [Ben Combee](https://github.com/unwiredben):
+ Regex optimization
+ * [Adam Backstrom](https://github.com/abackstrom):
+ WebKit bugfix
+ * [Pascal Deschênes](https://github.com/pdeschen):
+ Grunt support, extension fixes + additions, packaging improvements, documentation
+ * [Estevão Santos](http://soares-dos-santos.com)
+ Bug fixing and later maintainer
+
+ - Original Project
+ * [John Gruber](http://daringfireball.net/projects/markdown/)
+ Author of Markdown
+ * [John Fraser](http://attacklab.net/)
+ Author of Showdown
diff --git a/Gruntfile.js b/Gruntfile.js
index 47d9262..dc95551 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -9,28 +9,13 @@ module.exports = function (grunt) {
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
- separator: ';',
- sourceMap: true
+ sourceMap: true,
+ banner: ";/*! <%= pkg.name %> <%= grunt.template.today('dd-mm-yyyy') %> */\n(function(){\n 'use strict';\n",
+ footer: "}).call(this)"
},
dist: {
- src: ['src/showdown.js', 'src/*.js'],
- dest: 'compressed/<%= pkg.name %>.js'
- },
- github_ext: {
- src: ['src/extensions/github.js'],
- dest: 'compressed/extensions/github.min.js'
- },
- prettify_ext: {
- src: ['src/extensions/prettify.js'],
- dest: 'compressed/extensions/prettify.min.js'
- },
- table_ext: {
- src: ['src/extensions/table.js'],
- dest: 'compressed/extensions/table.min.js'
- },
- twitter_ext: {
- src: ['src/extensions/twitter.js'],
- dest: 'compressed/extensions/twitter.min.js'
+ src: ['src/showdown.js', 'src/helpers.js', 'src/subParsers/*.js', 'src/loader.js'],
+ dest: 'dist/<%= pkg.name %>.js'
}
},
uglify: {
@@ -39,41 +24,21 @@ module.exports = function (grunt) {
},
dist: {
files: {
- 'compressed/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>']
- }
- },
- github_ext: {
- files: {
- 'compressed/extensions/github.min.js': ['<%= concat.github_ext.dest %>']
- }
- },
- prettify_ext: {
- files: {
- 'compressed/extensions/prettify.min.js': ['<%= concat.prettify_ext.dest %>']
- }
- },
- table_ext: {
- files: {
- 'compressed/extensions/table.min.js': ['<%= concat.table_ext.dest %>']
- }
- },
- twitter_ext: {
- files: {
- 'compressed/extensions/twitter.min.js': ['<%= concat.twitter_ext.dest %>']
+ 'dist/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>']
}
}
},
jshint: {
- files: ['Gruntfile.js', 'src/**/*.js', 'test/**/*.js']
+ files: ['Gruntfile.js', 'src/**/*.js']
},
simplemocha: {
all: {
- src: 'test/run.js',
+ src: 'test/**/*.js',
options: {
globals: ['should'],
timeout: 3000,
ignoreLeaks: false,
- ui: 'bdd'
+ reporter: 'spec'
}
}
}
@@ -85,16 +50,23 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-simple-mocha');
// test
+ /*
+ grunt.registerTask('sourceMapsSupport', function() {
+ 'use strict';
+
+ //# sourceMappingURL=path/to/source.map
+ sourceMapSupport.install();
+ });
+ */
grunt.registerTask('lint', ['jshint']);
- grunt.registerTask('test', ['simplemocha']);
+ grunt.registerTask('test', ['jshint', 'concat', 'simplemocha']);
+ grunt.registerTask('test-without-building', ['simplemocha']);
// build with uglify
grunt.registerTask('build', ['concat', 'uglify']);
- // Build with closure compiler
- grunt.registerTask('build-with-closure', ['test', 'concat', 'closure-compiler']);
-
// Default task(s).
grunt.registerTask('default', []);
+
};
diff --git a/README.md b/README.md
index 139e0df..036de30 100644
--- a/README.md
+++ b/README.md
@@ -1,315 +1,323 @@
-# Showdown
-
-A JavaScript port of Markdown
-
-## Note
-
- > Showdown is now maintained by the [showdownjs](https://github.com/showdownjs) organization on Github.
- >
- > The organization needs members to maintain Showdown.
- >
- > Please see [this issue](https://github.com/showdownjs/showdown/issues/114) to express interest or comment on this note.
-
-## Original Attributions
-
-Showdown Copyright (c) 2007 John Fraser.
-
s around - // "paragraphs" that are wrapped in non-block-level tags, such as anchors, - // phrase emphasis, and spans. The list of tags we're looking for is - // hard-coded: - var block_tags_a = "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"; - var block_tags_b = "p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|style|section|header|footer|nav|article|aside"; - - // First, look for nested blocks, e.g.: - //
tags around block-level tags.
- text = _HashHTMLBlocks(text);
- text = _FormParagraphs(text);
-
- return text;
- };
-
- var _RunSpanGamut = function (text) {
-//
-// These are all the transformations that occur *within* block-level
-// tags like paragraphs, headers, and list items.
-//
-
- text = _DoCodeSpans(text);
- text = _EscapeSpecialCharsWithinTagAttributes(text);
- text = _EncodeBackslashEscapes(text);
-
- // Process anchor and image tags. Images must come first,
- // because ![foo][f] looks like an anchor.
- text = _DoImages(text);
- text = _DoAnchors(text);
-
- // Make links out of things like ` Just type tags
-//
-
- // Strip leading and trailing lines:
- text = text.replace(/^\n+/g, "");
- text = text.replace(/\n+$/g, "");
-
- var grafs = text.split(/\n{2,}/g);
- var grafsOut = [];
-
- //
- // Wrap tags.
- //
- var end = grafs.length;
- for (var i = 0; i < end; i++) {
- var str = grafs[i];
-
- // if this is an HTML marker, copy it
- if (str.search(/~K(\d+)K/g) >= 0) {
- grafsOut.push(str);
- }
- else if (str.search(/\S/) >= 0) {
- str = _RunSpanGamut(str);
- str = str.replace(/^([ \t]*)/g, " ");
- str += " s around\r\n // \"paragraphs\" that are wrapped in non-block-level tags, such as anchors,\r\n // phrase emphasis, and spans. The list of tags we're looking for is\r\n // hard-coded:\r\n var block_tags_a = \"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\";\r\n var block_tags_b = \"p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|style|section|header|footer|nav|article|aside\";\r\n\r\n // First, look for nested blocks, e.g.:\r\n // tags around block-level tags.\r\n text = _HashHTMLBlocks(text);\r\n text = _FormParagraphs(text);\r\n\r\n return text;\r\n };\r\n\r\n var _RunSpanGamut = function (text) {\r\n//\r\n// These are all the transformations that occur *within* block-level\r\n// tags like paragraphs, headers, and list items.\r\n//\r\n\r\n text = _DoCodeSpans(text);\r\n text = _EscapeSpecialCharsWithinTagAttributes(text);\r\n text = _EncodeBackslashEscapes(text);\r\n\r\n // Process anchor and image tags. Images must come first,\r\n // because ![foo][f] looks like an anchor.\r\n text = _DoImages(text);\r\n text = _DoAnchors(text);\r\n\r\n // Make links out of things like ` Just type tags\r\n//\r\n\r\n // Strip leading and trailing lines:\r\n text = text.replace(/^\\n+/g, \"\");\r\n text = text.replace(/\\n+$/g, \"\");\r\n\r\n var grafs = text.split(/\\n{2,}/g);\r\n var grafsOut = [];\r\n\r\n //\r\n // Wrap tags.\r\n //\r\n var end = grafs.length;\r\n for (var i = 0; i < end; i++) {\r\n var str = grafs[i];\r\n\r\n // if this is an HTML marker, copy it\r\n if (str.search(/~K(\\d+)K/g) >= 0) {\r\n grafsOut.push(str);\r\n }\r\n else if (str.search(/\\S/) >= 0) {\r\n str = _RunSpanGamut(str);\r\n str = str.replace(/^([ \\t]*)/g, \" \");\r\n str += \" "),g+=" *for syntax.txt to load, requires a localhost server
\n");
-
- return text;
- }
-
- var _EscapeSpecialCharsWithinTagAttributes = function (text) {
-//
-// Within tags -- meaning between < and > -- encode [\ ` * _] so they
-// don't conflict with their use in Markdown for code, italics and strong.
-//
-
- // Build a regex to find HTML tags and comments. See Friedl's
- // "Mastering Regular Expressions", 2nd Ed., pp. 200-201.
- var regex = /(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|)/gi;
-
- text = text.replace(regex, function (wholeMatch) {
- var tag = wholeMatch.replace(/(.)<\/?code>(?=.)/g, "$1`");
- tag = escapeCharacters(tag, "\\`*_");
- return tag;
- });
-
- return text;
- }
-
- var _DoAnchors = function (text) {
-//
-// Turn Markdown link shortcuts into XHTML tags.
-//
- //
- // First, handle reference-style links: [link text] [id]
- //
-
- /*
- text = text.replace(/
- ( // wrap whole match in $1
- \[
- (
- (?:
- \[[^\]]*\] // allow brackets nested one level
- |
- [^\[] // or anything else
- )*
- )
- \]
-
- [ ]? // one optional space
- (?:\n[ ]*)? // one optional newline followed by spaces
-
- \[
- (.*?) // id = $3
- \]
- )()()()() // pad remaining backreferences
- /g,_DoAnchors_callback);
- */
- text = text.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g, writeAnchorTag);
-
- //
- // Next, inline-style links: [link text](url "optional title")
- //
-
- /*
- text = text.replace(/
- ( // wrap whole match in $1
- \[
- (
- (?:
- \[[^\]]*\] // allow brackets nested one level
- |
- [^\[\]] // or anything else
- )
- )
- \]
- \( // literal paren
- [ \t]*
- () // no id, so leave $3 empty
- (.*?)>? // href = $4
- [ \t]*
- ( // $5
- (['"]) // quote char = $6
- (.*?) // Title = $7
- \6 // matching quote
- [ \t]* // ignore any spaces/tabs between closing quote and )
- )? // title is optional
- \)
- )
- /g,writeAnchorTag);
- */
- text = text.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()(.*?(?:\(.*?\).*?)?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g, writeAnchorTag);
-
- //
- // Last, handle reference-style shortcuts: [link text]
- // These must come last in case you've also got [link test][1]
- // or [link test](/foo)
- //
-
- /*
- text = text.replace(/
- ( // wrap whole match in $1
- \[
- ([^\[\]]+) // link text = $2; can't contain '[' or ']'
- \]
- )()()()()() // pad rest of backreferences
- /g, writeAnchorTag);
- */
- text = text.replace(/(\[([^\[\]]+)\])()()()()()/g, writeAnchorTag);
-
- return text;
- }
-
- var writeAnchorTag = function (wholeMatch, m1, m2, m3, m4, m5, m6, m7) {
- if (m7 == undefined) m7 = "";
- var whole_match = m1;
- var link_text = m2;
- var link_id = m3.toLowerCase();
- var url = m4;
- var title = m7;
-
- if (url == "") {
- if (link_id == "") {
- // lower-case and turn embedded newlines into spaces
- link_id = link_text.toLowerCase().replace(/ ?\n/g, " ");
- }
- url = "#" + link_id;
-
- if (g_urls[link_id] != undefined) {
- url = g_urls[link_id];
- if (g_titles[link_id] != undefined) {
- title = g_titles[link_id];
- }
- }
- else {
- if (whole_match.search(/\(\s*\)$/m) > -1) {
- // Special case for explicit empty url
- url = "";
- } else {
- return whole_match;
- }
- }
- }
-
- url = escapeCharacters(url, "*_");
- var result = "" + link_text + "";
-
- return result;
- }
-
- var _DoImages = function (text) {
-//
-// Turn Markdown image shortcuts into tags.
-//
-
- //
- // First, handle reference-style labeled images: ![alt text][id]
- //
-
- /*
- text = text.replace(/
- ( // wrap whole match in $1
- !\[
- (.*?) // alt text = $2
- \]
-
- [ ]? // one optional space
- (?:\n[ ]*)? // one optional newline followed by spaces
-
- \[
- (.*?) // id = $3
- \]
- )()()()() // pad rest of backreferences
- /g,writeImageTag);
- */
- text = text.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g, writeImageTag);
-
- //
- // Next, handle inline images: ![alt text](url "optional title")
- // Don't forget: encode * and _
-
- /*
- text = text.replace(/
- ( // wrap whole match in $1
- !\[
- (.*?) // alt text = $2
- \]
- \s? // One optional whitespace character
- \( // literal paren
- [ \t]*
- () // no id, so leave $3 empty
- (\S+?)>? // src url = $4
- [ \t]*
- ( // $5
- (['"]) // quote char = $6
- (.*?) // title = $7
- \6 // matching quote
- [ \t]*
- )? // title is optional
- \)
- )
- /g,writeImageTag);
- */
- text = text.replace(/(!\[(.*?)\]\s?\([ \t]*()(\S+?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g, writeImageTag);
-
- return text;
- }
-
- var writeImageTag = function (wholeMatch, m1, m2, m3, m4, m5, m6, m7) {
- var whole_match = m1;
- var alt_text = m2;
- var link_id = m3.toLowerCase();
- var url = m4;
- var title = m7;
-
- if (!title) title = "";
-
- if (url == "") {
- if (link_id == "") {
- // lower-case and turn embedded newlines into spaces
- link_id = alt_text.toLowerCase().replace(/ ?\n/g, " ");
- }
- url = "#" + link_id;
-
- if (g_urls[link_id] != undefined) {
- url = g_urls[link_id];
- if (g_titles[link_id] != undefined) {
- title = g_titles[link_id];
- }
- }
- else {
- return whole_match;
- }
- }
-
- alt_text = alt_text.replace(/"/g, """);
- url = escapeCharacters(url, "*_");
- var result = "";
-
- return result;
- }
-
- var _DoHeaders = function (text) {
-
- // Setext-style headers:
- // Header 1
- // ========
- //
- // Header 2
- // --------
- //
- text = text.replace(/^(.+)[ \t]*\n=+[ \t]*\n+/gm,
- function (wholeMatch, m1) {
- return hashBlock('' + _RunSpanGamut(m1) + "
");
- });
-
- text = text.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm,
- function (matchFound, m1) {
- return hashBlock('' + _RunSpanGamut(m1) + "
");
- });
-
- // atx-style headers:
- // # Header 1
- // ## Header 2
- // ## Header 2 with closing hashes ##
- // ...
- // ###### Header 6
- //
-
- /*
- text = text.replace(/
- ^(\#{1,6}) // $1 = string of #'s
- [ \t]*
- (.+?) // $2 = Header text
- [ \t]*
- \#* // optional closing #'s (not counted)
- \n+
- /gm, function() {...});
- */
-
- text = text.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm,
- function (wholeMatch, m1, m2) {
- var h_level = m1.length;
- return hashBlock("` blocks.
-//
-
- /*
- text = text.replace(text,
- /(?:\n\n|^)
- ( // $1 = the code block -- one or more lines, starting with a space/tab
- (?:
- (?:[ ]{4}|\t) // Lines must start with a tab or a tab-width of spaces - attacklab: g_tab_width
- .*\n+
- )+
- )
- (\n*[ ]{0,3}[^ \t\n]|(?=~0)) // attacklab: g_tab_width
- /g,function(){...});
- */
-
- // attacklab: sentinel workarounds for lack of \A and \Z, safari\khtml bug
- text += "~0";
-
- text = text.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g,
- function (wholeMatch, m1, m2) {
- var codeblock = m1;
- var nextChar = m2;
-
- codeblock = _EncodeCode(_Outdent(codeblock));
- codeblock = _Detab(codeblock);
- codeblock = codeblock.replace(/^\n+/g, ""); // trim leading newlines
- codeblock = codeblock.replace(/\n+$/g, ""); // trim trailing whitespace
-
- codeblock = "
";
-
- return hashBlock(codeblock) + nextChar;
- }
- );
-
- // attacklab: strip sentinel
- text = text.replace(/~0/, "");
-
- return text;
- };
-
- var _DoGithubCodeBlocks = function (text) {
-//
-// Process Github-style code blocks
-// Example:
-// ```ruby
-// def hello_world(x)
-// puts "Hello, #{x}"
-// end
-// ```
-//
-
-
- // attacklab: sentinel workarounds for lack of \A and \Z, safari\khtml bug
- text += "~0";
-
- text = text.replace(/(?:^|\n)```(.*)\n([\s\S]*?)\n```/g,
- function (wholeMatch, m1, m2) {
- var language = m1;
- var codeblock = m2;
-
- codeblock = _EncodeCode(codeblock);
- codeblock = _Detab(codeblock);
- codeblock = codeblock.replace(/^\n+/g, ""); // trim leading newlines
- codeblock = codeblock.replace(/\n+$/g, ""); // trim trailing whitespace
-
- codeblock = "" + codeblock + "\n
";
-
- return hashBlock(codeblock);
- }
- );
-
- // attacklab: strip sentinel
- text = text.replace(/~0/, "");
-
- return text;
- }
-
- var hashBlock = function (text) {
- text = text.replace(/(^\n+|\n+$)/g, "");
- return "\n\n~K" + (g_html_blocks.push(text) - 1) + "K\n\n";
- }
-
- var _DoCodeSpans = function (text) {
-//
-// * Backtick quotes are used for " + codeblock + "\n
spans.
-//
-// * You can use multiple backticks as the delimiters if you want to
-// include literal backticks in the code span. So, this input:
-//
-// Just type ``foo `bar` baz`` at the prompt.
-//
-// Will translate to:
-//
-//
foo `bar` baz
at the prompt.`bar`
...
-//
-
- /*
- text = text.replace(/
- (^|[^\\]) // Character before opening ` can't be a backslash
- (`+) // $2 = Opening run of `
- ( // $3 = The code block
- [^\r]*?
- [^`] // attacklab: work around lack of lookbehind
- )
- \2 // Matching closer
- (?!`)
- /gm, function(){...});
- */
-
- text = text.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,
- function (wholeMatch, m1, m2, m3, m4) {
- var c = m3;
- c = c.replace(/^([ \t]*)/g, ""); // leading whitespace
- c = c.replace(/[ \t]*$/g, ""); // trailing whitespace
- c = _EncodeCode(c);
- return m1 + "" + c + "
";
- });
-
- return text;
- }
-
- var _EncodeCode = function (text) {
-//
-// Encode/escape certain characters inside Markdown code runs.
-// The point is that in code, these characters are literals,
-// and lose their special Markdown meanings.
-//
- // Encode all ampersands; HTML entities are not
- // entities within a Markdown code span.
- text = text.replace(/&/g, "&");
-
- // Do the angle bracket song and dance:
- text = text.replace(//g, ">");
-
- // Now, escape characters that are magic in Markdown:
- text = escapeCharacters(text, "\*_{}[]\\", false);
-
-// jj the line above breaks this:
-//---
-
-//* Item
-
-// 1. Subitem
-
-// special char: *
-//---
-
- return text;
- }
-
- var _DoItalicsAndBold = function (text) {
-
- // must go first:
- text = text.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g,
- "$2");
-
- text = text.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g,
- "$2");
-
- return text;
- }
-
- var _DoBlockQuotes = function (text) {
-
- /*
- text = text.replace(/
- ( // Wrap whole match in $1
- (
- ^[ \t]*>[ \t]? // '>' at the start of a line
- .+\n // rest of the first line
- (.+\n)* // subsequent consecutive lines
- \n* // blanks
- )+
- )
- /gm, function(){...});
- */
-
- text = text.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm,
- function (wholeMatch, m1) {
- var bq = m1;
-
- // attacklab: hack around Konqueror 3.5.4 bug:
- // "----------bug".replace(/^-/g,"") == "bug"
-
- bq = bq.replace(/^[ \t]*>[ \t]?/gm, "~0"); // trim one level of quoting
-
- // attacklab: clean up hack
- bq = bq.replace(/~0/g, "");
-
- bq = bq.replace(/^[ \t]+$/gm, ""); // trim whitespace-only lines
- bq = _RunBlockGamut(bq); // recurse
-
- bq = bq.replace(/(^|\n)/g, "$1 ");
- // These leading spaces screw with content, so we need to fix that:
- bq = bq.replace(
- /(\s*
[^\r]+?<\/pre>)/gm,
- function (wholeMatch, m1) {
- var pre = m1;
- // attacklab: hack around Konqueror 3.5.4 bug:
- pre = pre.replace(/^ /mg, "~0");
- pre = pre.replace(/~0/g, "");
- return pre;
- });
-
- return hashBlock("
\n" + bq + "\n
");
- });
- return text;
- }
-
- var _FormParagraphs = function (text) {
-//
-// Params:
-// $text - string to process with html
. It was easier to make a special case than\r\n // to make the other regex more complicated.\r\n\r\n /*\r\n text = text.replace(/\r\n (\t\t\t\t\t\t// save in $1\r\n \\n\\n\t\t\t\t// Starting after a blank line\r\n [ ]{0,3}\r\n (<(hr)\t\t\t\t// start tag = $2\r\n \\b\t\t\t\t\t// word break\r\n ([^<>])*?\t\t\t//\r\n \\/?>)\t\t\t\t// the matching end tag\r\n [ \\t]*\r\n (?=\\n{2,})\t\t\t// followed by a blank line\r\n )\r\n /g,hashElement);\r\n */\r\n text = text.replace(/(\\n[ ]{0,3}(<(hr)\\b([^<>])*?\\/?>)[ \\t]*(?=\\n{2,}))/g, hashElement);\r\n\r\n // Special case for standalone HTML comments:\r\n\r\n /*\r\n text = text.replace(/\r\n (\t\t\t\t\t\t// save in $1\r\n \\n\\n\t\t\t\t// Starting after a blank line\r\n [ ]{0,3}\t\t\t// attacklab: g_tab_width - 1\r\n \r\n [ \\t]*\r\n (?=\\n{2,})\t\t\t// followed by a blank line\r\n )\r\n /g,hashElement);\r\n */\r\n text = text.replace(/(\\n\\n[ ]{0,3}[ \\t]*(?=\\n{2,}))/g, hashElement);\r\n\r\n // PHP and ASP-style processor instructions (...?> and <%...%>)\r\n\r\n /*\r\n text = text.replace(/\r\n (?:\r\n \\n\\n\t\t\t\t// Starting after a blank line\r\n )\r\n (\t\t\t\t\t\t// save in $1\r\n [ ]{0,3}\t\t\t// attacklab: g_tab_width - 1\r\n (?:\r\n <([?%])\t\t\t// $2\r\n [^\\r]*?\r\n \\2>\r\n )\r\n [ \\t]*\r\n (?=\\n{2,})\t\t\t// followed by a blank line\r\n )\r\n /g,hashElement);\r\n */\r\n text = text.replace(/(?:\\n\\n)([ ]{0,3}(?:<([?%])[^\\r]*?\\2>)[ \\t]*(?=\\n{2,}))/g, hashElement);\r\n\r\n // attacklab: Undo double lines (see comment at top of this function)\r\n text = text.replace(/\\n\\n/g, \"\\n\");\r\n return text;\r\n }\r\n\r\n var hashElement = function (wholeMatch, m1) {\r\n var blockText = m1;\r\n\r\n // Undo double lines\r\n blockText = blockText.replace(/\\n\\n/g, \"\\n\");\r\n blockText = blockText.replace(/^\\n/, \"\");\r\n\r\n // strip trailing blank lines\r\n blockText = blockText.replace(/\\n+$/g, \"\");\r\n\r\n // Replace the element text with a marker (\"~KxK\" where x is its key)\r\n blockText = \"\\n\\n~K\" + (g_html_blocks.push(blockText) - 1) + \"K\\n\\n\";\r\n\r\n return blockText;\r\n };\r\n\r\n var _RunBlockGamut = function (text) {\r\n//\r\n// These are all the transformations that form block-level\r\n// tags like paragraphs, headers, and list items.\r\n//\r\n text = _DoHeaders(text);\r\n\r\n // Do Horizontal Rules:\r\n var key = hashBlock(\"
\");\r\n text = text.replace(/^[ ]{0,2}([ ]?\\*[ ]?){3,}[ \\t]*$/gm, key);\r\n text = text.replace(/^[ ]{0,2}([ ]?\\-[ ]?){3,}[ \\t]*$/gm, key);\r\n text = text.replace(/^[ ]{0,2}([ ]?\\_[ ]?){3,}[ \\t]*$/gm, key);\r\n\r\n text = _DoLists(text);\r\n text = _DoCodeBlocks(text);\r\n text = _DoBlockQuotes(text);\r\n\r\n // We already ran _HashHTMLBlocks() before, in Markdown(), but that\r\n // was to escape raw HTML in the original Markdown source. This time,\r\n // we're escaping the markup we've just created, so that we don't wrap\r\n //
\\n\");\r\n\r\n return text;\r\n }\r\n\r\n var _EscapeSpecialCharsWithinTagAttributes = function (text) {\r\n//\r\n// Within tags -- meaning between < and > -- encode [\\ ` * _] so they\r\n// don't conflict with their use in Markdown for code, italics and strong.\r\n//\r\n\r\n // Build a regex to find HTML tags and comments. See Friedl's\r\n // \"Mastering Regular Expressions\", 2nd Ed., pp. 200-201.\r\n var regex = /(<[a-z\\/!$](\"[^\"]*\"|'[^']*'|[^'\">])*>|)/gi;\r\n\r\n text = text.replace(regex, function (wholeMatch) {\r\n var tag = wholeMatch.replace(/(.)<\\/?code>(?=.)/g, \"$1`\");\r\n tag = escapeCharacters(tag, \"\\\\`*_\");\r\n return tag;\r\n });\r\n\r\n return text;\r\n }\r\n\r\n var _DoAnchors = function (text) {\r\n//\r\n// Turn Markdown link shortcuts into XHTML tags.\r\n//\r\n //\r\n // First, handle reference-style links: [link text] [id]\r\n //\r\n\r\n /*\r\n text = text.replace(/\r\n (\t\t\t\t\t\t\t// wrap whole match in $1\r\n \\[\r\n (\r\n (?:\r\n \\[[^\\]]*\\]\t\t// allow brackets nested one level\r\n |\r\n [^\\[]\t\t\t// or anything else\r\n )*\r\n )\r\n \\]\r\n\r\n [ ]?\t\t\t\t\t// one optional space\r\n (?:\\n[ ]*)?\t\t\t\t// one optional newline followed by spaces\r\n\r\n \\[\r\n (.*?)\t\t\t\t\t// id = $3\r\n \\]\r\n )()()()()\t\t\t\t\t// pad remaining backreferences\r\n /g,_DoAnchors_callback);\r\n */\r\n text = text.replace(/(\\[((?:\\[[^\\]]*\\]|[^\\[\\]])*)\\][ ]?(?:\\n[ ]*)?\\[(.*?)\\])()()()()/g, writeAnchorTag);\r\n\r\n //\r\n // Next, inline-style links: [link text](url \"optional title\")\r\n //\r\n\r\n /*\r\n text = text.replace(/\r\n (\t\t\t\t\t\t// wrap whole match in $1\r\n \\[\r\n (\r\n (?:\r\n \\[[^\\]]*\\]\t// allow brackets nested one level\r\n |\r\n [^\\[\\]]\t\t\t// or anything else\r\n )\r\n )\r\n \\]\r\n \\(\t\t\t\t\t\t// literal paren\r\n [ \\t]*\r\n ()\t\t\t\t\t\t// no id, so leave $3 empty\r\n (.*?)>?\t\t\t\t// href = $4\r\n [ \\t]*\r\n (\t\t\t\t\t\t// $5\r\n (['\"])\t\t\t\t// quote char = $6\r\n (.*?)\t\t\t\t// Title = $7\r\n \\6\t\t\t\t\t// matching quote\r\n [ \\t]*\t\t\t\t// ignore any spaces/tabs between closing quote and )\r\n )?\t\t\t\t\t\t// title is optional\r\n \\)\r\n )\r\n /g,writeAnchorTag);\r\n */\r\n text = text.replace(/(\\[((?:\\[[^\\]]*\\]|[^\\[\\]])*)\\]\\([ \\t]*()(.*?(?:\\(.*?\\).*?)?)>?[ \\t]*((['\"])(.*?)\\6[ \\t]*)?\\))/g, writeAnchorTag);\r\n\r\n //\r\n // Last, handle reference-style shortcuts: [link text]\r\n // These must come last in case you've also got [link test][1]\r\n // or [link test](/foo)\r\n //\r\n\r\n /*\r\n text = text.replace(/\r\n (\t\t \t\t\t\t\t// wrap whole match in $1\r\n \\[\r\n ([^\\[\\]]+)\t\t\t\t// link text = $2; can't contain '[' or ']'\r\n \\]\r\n )()()()()()\t\t\t\t\t// pad rest of backreferences\r\n /g, writeAnchorTag);\r\n */\r\n text = text.replace(/(\\[([^\\[\\]]+)\\])()()()()()/g, writeAnchorTag);\r\n\r\n return text;\r\n }\r\n\r\n var writeAnchorTag = function (wholeMatch, m1, m2, m3, m4, m5, m6, m7) {\r\n if (m7 == undefined) m7 = \"\";\r\n var whole_match = m1;\r\n var link_text = m2;\r\n var link_id = m3.toLowerCase();\r\n var url = m4;\r\n var title = m7;\r\n\r\n if (url == \"\") {\r\n if (link_id == \"\") {\r\n // lower-case and turn embedded newlines into spaces\r\n link_id = link_text.toLowerCase().replace(/ ?\\n/g, \" \");\r\n }\r\n url = \"#\" + link_id;\r\n\r\n if (g_urls[link_id] != undefined) {\r\n url = g_urls[link_id];\r\n if (g_titles[link_id] != undefined) {\r\n title = g_titles[link_id];\r\n }\r\n }\r\n else {\r\n if (whole_match.search(/\\(\\s*\\)$/m) > -1) {\r\n // Special case for explicit empty url\r\n url = \"\";\r\n } else {\r\n return whole_match;\r\n }\r\n }\r\n }\r\n\r\n url = escapeCharacters(url, \"*_\");\r\n var result = \"\" + link_text + \"\";\r\n\r\n return result;\r\n }\r\n\r\n var _DoImages = function (text) {\r\n//\r\n// Turn Markdown image shortcuts into tags.\r\n//\r\n\r\n //\r\n // First, handle reference-style labeled images: ![alt text][id]\r\n //\r\n\r\n /*\r\n text = text.replace(/\r\n (\t\t\t\t\t\t// wrap whole match in $1\r\n !\\[\r\n (.*?)\t\t\t\t// alt text = $2\r\n \\]\r\n\r\n [ ]?\t\t\t\t// one optional space\r\n (?:\\n[ ]*)?\t\t\t// one optional newline followed by spaces\r\n\r\n \\[\r\n (.*?)\t\t\t\t// id = $3\r\n \\]\r\n )()()()()\t\t\t\t// pad rest of backreferences\r\n /g,writeImageTag);\r\n */\r\n text = text.replace(/(!\\[(.*?)\\][ ]?(?:\\n[ ]*)?\\[(.*?)\\])()()()()/g, writeImageTag);\r\n\r\n //\r\n // Next, handle inline images: ![alt text](url \"optional title\")\r\n // Don't forget: encode * and _\r\n\r\n /*\r\n text = text.replace(/\r\n (\t\t\t\t\t\t// wrap whole match in $1\r\n !\\[\r\n (.*?)\t\t\t\t// alt text = $2\r\n \\]\r\n \\s?\t\t\t\t\t// One optional whitespace character\r\n \\(\t\t\t\t\t// literal paren\r\n [ \\t]*\r\n ()\t\t\t\t\t// no id, so leave $3 empty\r\n (\\S+?)>?\t\t\t// src url = $4\r\n [ \\t]*\r\n (\t\t\t\t\t// $5\r\n (['\"])\t\t\t// quote char = $6\r\n (.*?)\t\t\t// title = $7\r\n \\6\t\t\t\t// matching quote\r\n [ \\t]*\r\n )?\t\t\t\t\t// title is optional\r\n \\)\r\n )\r\n /g,writeImageTag);\r\n */\r\n text = text.replace(/(!\\[(.*?)\\]\\s?\\([ \\t]*()(\\S+?)>?[ \\t]*((['\"])(.*?)\\6[ \\t]*)?\\))/g, writeImageTag);\r\n\r\n return text;\r\n }\r\n\r\n var writeImageTag = function (wholeMatch, m1, m2, m3, m4, m5, m6, m7) {\r\n var whole_match = m1;\r\n var alt_text = m2;\r\n var link_id = m3.toLowerCase();\r\n var url = m4;\r\n var title = m7;\r\n\r\n if (!title) title = \"\";\r\n\r\n if (url == \"\") {\r\n if (link_id == \"\") {\r\n // lower-case and turn embedded newlines into spaces\r\n link_id = alt_text.toLowerCase().replace(/ ?\\n/g, \" \");\r\n }\r\n url = \"#\" + link_id;\r\n\r\n if (g_urls[link_id] != undefined) {\r\n url = g_urls[link_id];\r\n if (g_titles[link_id] != undefined) {\r\n title = g_titles[link_id];\r\n }\r\n }\r\n else {\r\n return whole_match;\r\n }\r\n }\r\n\r\n alt_text = alt_text.replace(/\"/g, \""\");\r\n url = escapeCharacters(url, \"*_\");\r\n var result = \"\";\r\n\r\n return result;\r\n }\r\n\r\n var _DoHeaders = function (text) {\r\n\r\n // Setext-style headers:\r\n //\tHeader 1\r\n //\t========\r\n //\r\n //\tHeader 2\r\n //\t--------\r\n //\r\n text = text.replace(/^(.+)[ \\t]*\\n=+[ \\t]*\\n+/gm,\r\n function (wholeMatch, m1) {\r\n return hashBlock('' + _RunSpanGamut(m1) + \"
\");\r\n });\r\n\r\n text = text.replace(/^(.+)[ \\t]*\\n-+[ \\t]*\\n+/gm,\r\n function (matchFound, m1) {\r\n return hashBlock('' + _RunSpanGamut(m1) + \"
\");\r\n });\r\n\r\n // atx-style headers:\r\n // # Header 1\r\n // ## Header 2\r\n // ## Header 2 with closing hashes ##\r\n // ...\r\n // ###### Header 6\r\n //\r\n\r\n /*\r\n text = text.replace(/\r\n ^(\\#{1,6})\t\t\t\t// $1 = string of #'s\r\n [ \\t]*\r\n (.+?)\t\t\t\t\t// $2 = Header text\r\n [ \\t]*\r\n \\#*\t\t\t\t\t\t// optional closing #'s (not counted)\r\n \\n+\r\n /gm, function() {...});\r\n */\r\n\r\n text = text.replace(/^(\\#{1,6})[ \\t]*(.+?)[ \\t]*\\#*\\n+/gm,\r\n function (wholeMatch, m1, m2) {\r\n var h_level = m1.length;\r\n return hashBlock(\"` blocks.\r\n//\r\n\r\n /*\r\n text = text.replace(text,\r\n /(?:\\n\\n|^)\r\n (\t\t\t\t\t\t\t\t// $1 = the code block -- one or more lines, starting with a space/tab\r\n (?:\r\n (?:[ ]{4}|\\t)\t\t\t// Lines must start with a tab or a tab-width of spaces - attacklab: g_tab_width\r\n .*\\n+\r\n )+\r\n )\r\n (\\n*[ ]{0,3}[^ \\t\\n]|(?=~0))\t// attacklab: g_tab_width\r\n /g,function(){...});\r\n */\r\n\r\n // attacklab: sentinel workarounds for lack of \\A and \\Z, safari\\khtml bug\r\n text += \"~0\";\r\n\r\n text = text.replace(/(?:\\n\\n|^)((?:(?:[ ]{4}|\\t).*\\n+)+)(\\n*[ ]{0,3}[^ \\t\\n]|(?=~0))/g,\r\n function (wholeMatch, m1, m2) {\r\n var codeblock = m1;\r\n var nextChar = m2;\r\n\r\n codeblock = _EncodeCode(_Outdent(codeblock));\r\n codeblock = _Detab(codeblock);\r\n codeblock = codeblock.replace(/^\\n+/g, \"\"); // trim leading newlines\r\n codeblock = codeblock.replace(/\\n+$/g, \"\"); // trim trailing whitespace\r\n\r\n codeblock = \"
\";\r\n\r\n return hashBlock(codeblock) + nextChar;\r\n }\r\n );\r\n\r\n // attacklab: strip sentinel\r\n text = text.replace(/~0/, \"\");\r\n\r\n return text;\r\n };\r\n\r\n var _DoGithubCodeBlocks = function (text) {\r\n//\r\n// Process Github-style code blocks\r\n// Example:\r\n// ```ruby\r\n// def hello_world(x)\r\n// puts \"Hello, #{x}\"\r\n// end\r\n// ```\r\n//\r\n\r\n\r\n // attacklab: sentinel workarounds for lack of \\A and \\Z, safari\\khtml bug\r\n text += \"~0\";\r\n\r\n text = text.replace(/(?:^|\\n)```(.*)\\n([\\s\\S]*?)\\n```/g,\r\n function (wholeMatch, m1, m2) {\r\n var language = m1;\r\n var codeblock = m2;\r\n\r\n codeblock = _EncodeCode(codeblock);\r\n codeblock = _Detab(codeblock);\r\n codeblock = codeblock.replace(/^\\n+/g, \"\"); // trim leading newlines\r\n codeblock = codeblock.replace(/\\n+$/g, \"\"); // trim trailing whitespace\r\n\r\n codeblock = \"\" + codeblock + \"\\n
\";\r\n\r\n return hashBlock(codeblock);\r\n }\r\n );\r\n\r\n // attacklab: strip sentinel\r\n text = text.replace(/~0/, \"\");\r\n\r\n return text;\r\n }\r\n\r\n var hashBlock = function (text) {\r\n text = text.replace(/(^\\n+|\\n+$)/g, \"\");\r\n return \"\\n\\n~K\" + (g_html_blocks.push(text) - 1) + \"K\\n\\n\";\r\n }\r\n\r\n var _DoCodeSpans = function (text) {\r\n//\r\n// * Backtick quotes are used for \" + codeblock + \"\\n
spans.\r\n//\r\n// * You can use multiple backticks as the delimiters if you want to\r\n//\t include literal backticks in the code span. So, this input:\r\n//\r\n//\t\t Just type ``foo `bar` baz`` at the prompt.\r\n//\r\n//\t Will translate to:\r\n//\r\n//\t\t
foo `bar` baz
at the prompt.`bar`
...\r\n//\r\n\r\n /*\r\n text = text.replace(/\r\n (^|[^\\\\])\t\t\t\t\t// Character before opening ` can't be a backslash\r\n (`+)\t\t\t\t\t\t// $2 = Opening run of `\r\n (\t\t\t\t\t\t\t// $3 = The code block\r\n [^\\r]*?\r\n [^`]\t\t\t\t\t// attacklab: work around lack of lookbehind\r\n )\r\n \\2\t\t\t\t\t\t\t// Matching closer\r\n (?!`)\r\n /gm, function(){...});\r\n */\r\n\r\n text = text.replace(/(^|[^\\\\])(`+)([^\\r]*?[^`])\\2(?!`)/gm,\r\n function (wholeMatch, m1, m2, m3, m4) {\r\n var c = m3;\r\n c = c.replace(/^([ \\t]*)/g, \"\");\t// leading whitespace\r\n c = c.replace(/[ \\t]*$/g, \"\");\t// trailing whitespace\r\n c = _EncodeCode(c);\r\n return m1 + \"\" + c + \"
\";\r\n });\r\n\r\n return text;\r\n }\r\n\r\n var _EncodeCode = function (text) {\r\n//\r\n// Encode/escape certain characters inside Markdown code runs.\r\n// The point is that in code, these characters are literals,\r\n// and lose their special Markdown meanings.\r\n//\r\n // Encode all ampersands; HTML entities are not\r\n // entities within a Markdown code span.\r\n text = text.replace(/&/g, \"&\");\r\n\r\n // Do the angle bracket song and dance:\r\n text = text.replace(//g, \">\");\r\n\r\n // Now, escape characters that are magic in Markdown:\r\n text = escapeCharacters(text, \"\\*_{}[]\\\\\", false);\r\n\r\n// jj the line above breaks this:\r\n//---\r\n\r\n//* Item\r\n\r\n// 1. Subitem\r\n\r\n// special char: *\r\n//---\r\n\r\n return text;\r\n }\r\n\r\n var _DoItalicsAndBold = function (text) {\r\n\r\n // must go first:\r\n text = text.replace(/(\\*\\*|__)(?=\\S)([^\\r]*?\\S[*_]*)\\1/g,\r\n \"$2\");\r\n\r\n text = text.replace(/(\\*|_)(?=\\S)([^\\r]*?\\S)\\1/g,\r\n \"$2\");\r\n\r\n return text;\r\n }\r\n\r\n var _DoBlockQuotes = function (text) {\r\n\r\n /*\r\n text = text.replace(/\r\n (\t\t\t\t\t\t\t\t// Wrap whole match in $1\r\n (\r\n ^[ \\t]*>[ \\t]?\t\t\t// '>' at the start of a line\r\n .+\\n\t\t\t\t\t// rest of the first line\r\n (.+\\n)*\t\t\t\t\t// subsequent consecutive lines\r\n \\n*\t\t\t\t\t\t// blanks\r\n )+\r\n )\r\n /gm, function(){...});\r\n */\r\n\r\n text = text.replace(/((^[ \\t]*>[ \\t]?.+\\n(.+\\n)*\\n*)+)/gm,\r\n function (wholeMatch, m1) {\r\n var bq = m1;\r\n\r\n // attacklab: hack around Konqueror 3.5.4 bug:\r\n // \"----------bug\".replace(/^-/g,\"\") == \"bug\"\r\n\r\n bq = bq.replace(/^[ \\t]*>[ \\t]?/gm, \"~0\");\t// trim one level of quoting\r\n\r\n // attacklab: clean up hack\r\n bq = bq.replace(/~0/g, \"\");\r\n\r\n bq = bq.replace(/^[ \\t]+$/gm, \"\");\t\t// trim whitespace-only lines\r\n bq = _RunBlockGamut(bq);\t\t\t\t// recurse\r\n\r\n bq = bq.replace(/(^|\\n)/g, \"$1 \");\r\n // These leading spaces screw with content, so we need to fix that:\r\n bq = bq.replace(\r\n /(\\s*
[^\\r]+?<\\/pre>)/gm,\r\n function (wholeMatch, m1) {\r\n var pre = m1;\r\n // attacklab: hack around Konqueror 3.5.4 bug:\r\n pre = pre.replace(/^ /mg, \"~0\");\r\n pre = pre.replace(/~0/g, \"\");\r\n return pre;\r\n });\r\n\r\n return hashBlock(\"
\\n\" + bq + \"\\n
\");\r\n });\r\n return text;\r\n }\r\n\r\n var _FormParagraphs = function (text) {\r\n//\r\n// Params:\r\n// $text - string to process with html
");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=n(a),a=F(a)},q=function(a){return a=B(a),a=r(a),a=H(a),a=u(a),a=s(a),a=I(a),a=G(a),a=D(a),a=a.replace(/ +\n/g,"
\n")},r=function(a){var b=/(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|)/gi;return a=a.replace(b,function(a){var b=a.replace(/(.)<\/?code>(?=.)/g,"$1`");return b=N(b,"\\`*_")})},s=function(a){return a=a.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,t),a=a.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()(.*?(?:\(.*?\).*?)?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,t),a=a.replace(/(\[([^\[\]]+)\])()()()()()/g,t)},t=function(a,d,e,f,g,h,i,j){void 0==j&&(j="");var k=d,l=e,m=f.toLowerCase(),n=g,o=j;if(""==n)if(""==m&&(m=l.toLowerCase().replace(/ ?\n/g," ")),n="#"+m,void 0!=b[m])n=b[m],void 0!=c[m]&&(o=c[m]);else{if(!(k.search(/\(\s*\)$/m)>-1))return k;n=""}n=N(n,"*_");var p='"+l+""},u=function(a){return a=a.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,v),a=a.replace(/(!\[(.*?)\]\s?\([ \t]*()(\S+?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,v)},v=function(a,d,e,f,g,h,i,j){var k=d,l=e,m=f.toLowerCase(),n=g,o=j;if(o||(o=""),""==n){if(""==m&&(m=l.toLowerCase().replace(/ ?\n/g," ")),n="#"+m,void 0==b[m])return k;n=b[m],void 0!=c[m]&&(o=c[m])}l=l.replace(/"/g,"""),n=N(n,"*_");var p='"},w=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(''+q(c)+"
")}),a=a.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm,function(a,c){return A(''+q(c)+"
")}),a=a.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm,function(a,c,d){var e=c.length;return A("
",A(d)+e}),a=a.replace(/~0/,"")},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=""+d+"\n
",A(e)}),a=a.replace(/~0/,"")},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){var e=d;return e=e.replace(/^([ \t]*)/g,""),e=e.replace(/[ \t]*$/g,""),e=C(e),b+""+e+"\n
"+e+"
"})},C=function(a){return a=a.replace(/&/g,"&"),a=a.replace(//g,">"),a=N(a,"*_{}[]\\",!1)},D=function(a){return a=a.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g,"$2"),a=a.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g,"$2")},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=p(c),c=c.replace(/(^|\n)/g,"$1 "),c=c.replace(/(\s*[^\r]+?<\/pre>)/gm,function(a,b){var c=b;return c=c.replace(/^ /gm,"~0"),c=c.replace(/~0/g,"")}),A("
\n"+c+"\n
")})},F=function(a){a=a.replace(/^\n+/g,""),a=a.replace(/\n+$/g,"");for(var b=a.split(/\n{2,}/g),c=[],e=b.length,f=0;e>f;f++){var g=b[f];g.search(/~K(\d+)K/g)>=0?c.push(g):g.search(/\S/)>=0&&(g=q(g),g=g.replace(/^([ \t]*)/g,""+c+""}}]};"undefined"!=typeof window&&window.Showdown&&window.Showdown.extensions&&(window.Showdown.extensions.github=a),"undefined"!=typeof module&&(module.exports=a)}();
\ No newline at end of file
diff --git a/compressed/extensions/github.min.js.map b/compressed/extensions/github.min.js.map
deleted file mode 100644
index 81eac82..0000000
--- a/compressed/extensions/github.min.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"sources":["..\\..\\src\\extensions\\github.js"],"names":[],"mappings":"AAAA;AAAA,IACI,MAAM,CAAC,SAAS,EAAE,GAAG;AAAA,MACnB,MAAM,CAAC,OAAO,UAAU,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG;AAAA;AAAA;AAAA,CAGpD,QAAQ;AAAA,IACL,GAAG,CAAC,MAAM,GAAG,QAAQ,CAAC,SAAS;AAAA,QAC3B,MAAM;AAAA;AAAA,iBAEG,MAAM,CAAC,OAAO;AAAA,iBACd,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,QAAQ,KAAK,IAAI,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,WAAW;AAAA,cAClF,IAAI,OAAO,IAAI;AAAA,cACf,KAAK,QAAQ,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC;AAAA,cAC/B,OAAO,GAAG,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;AAAA,kBAC7C,MAAM,GAAG,GAAG,KAAK,OAAO,MAAM,GAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAM5C,MAAM,CAAC,IAAI,CAAC,MAAM;AAAA,IACrB,EAAE,EAAE,MAAM,CAAC,MAAM,MAAM,SAAS,KAAK,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,UAAU,IAAI,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,GAAG,MAAM;AAAA,OAC7H,MAAM,CAAC,IAAI,CAAC,MAAM;AAAA,IACrB,EAAE,EAAE,MAAM,CAAC,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,GAAG,MAAM;AAAA","file":"github.min.js","sourcesContent":["//\r\n// Github Extension (WIP)\r\n// ~~strike-through~~ -> strike-through\r\n//\r\n\r\n(function(){\r\n var github = function(converter) {\r\n return [\r\n {\r\n // strike-through\r\n // NOTE: showdown already replaced \"~\" with \"~T\", so we need to adjust accordingly.\r\n type : 'lang',\r\n regex : '(~T){2}([^~]+)(~T){2}',\r\n replace : function(match, prefix, content, suffix) {\r\n return '' + content + '';\r\n }\r\n }\r\n ];\r\n };\r\n\r\n // Client-side export\r\n if (typeof window !== 'undefined' && window.Showdown && window.Showdown.extensions) { window.Showdown.extensions.github = github; }\r\n // Server-side export\r\n if (typeof module !== 'undefined') module.exports = github;\r\n}());\r\n"]}
\ No newline at end of file
diff --git a/compressed/extensions/prettify.min.js b/compressed/extensions/prettify.min.js
deleted file mode 100644
index bef2418..0000000
--- a/compressed/extensions/prettify.min.js
+++ /dev/null
@@ -1,2 +0,0 @@
-/*! showdown 06-01-2015 */
-!function(){var a=function(){return[{type:"output",filter:function(a){return a.replace(/()?
/gi,function(a,b){return b?'
':'
'})}}]};"undefined"!=typeof window&&window.Showdown&&window.Showdown.extensions&&(window.Showdown.extensions.prettify=a),"undefined"!=typeof module&&(module.exports=a)}();
\ No newline at end of file
diff --git a/compressed/extensions/prettify.min.js.map b/compressed/extensions/prettify.min.js.map
deleted file mode 100644
index b73852a..0000000
--- a/compressed/extensions/prettify.min.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"sources":["..\\..\\src\\extensions\\prettify.js"],"names":[],"mappings":"AAAA;AAAA,IACI,MAAM,CAAC,QAAQ;AAAA,IACf,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ;AAAA,IAC1F,KAAK,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM;AAAA;AAAA;AAAA,CAGlC,QAAQ;AAAA;AAAA,IAEL,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAC,SAAS;AAAA,QAC7B,MAAM;AAAA,cACA,IAAI,GAAG,MAAM,GAAG,MAAM,EAAE,QAAQ,CAAC,MAAM;AAAA;AAAA,gBAErC,MAAM,CAAC,MAAM,CAAC,OAAO,IAAI,GAAG,IAAI,IAAI,EAAE,EAAE,EAAE,QAAQ,CAAC,KAAK,EAAE,GAAG;AAAA,oBACzD,EAAE,EAAE,GAAG;AAAA,wBACH,MAAM,GAAG,GAAG,CAAC,KAAK,EAAE,WAAW,CAAC,QAAQ,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;AAAA,sBAC5E,IAAI;AAAA,wBACF,MAAM,GAAG,IAAI,CAAC,KAAK,EAAE,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAOjD,MAAM,CAAC,IAAI,CAAC,MAAM;AAAA,IACrB,EAAE,EAAE,MAAM,CAAC,MAAM,MAAM,SAAS,KAAK,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,UAAU,IAAI,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,QAAQ,GAAG,QAAQ;AAAA,OACjI,MAAM,CAAC,IAAI,CAAC,MAAM;AAAA,IACrB,EAAE,EAAE,MAAM,CAAC,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,GAAG,QAAQ;AAAA;AAAA","file":"prettify.min.js","sourcesContent":["//\r\n// Google Prettify\r\n// A showdown extension to add Google Prettify (http://code.google.com/p/google-code-prettify/)\r\n// hints to showdown's HTML output.\r\n//\r\n\r\n(function(){\r\n\r\n var prettify = function(converter) {\r\n return [\r\n { type: 'output', filter: function(source){\r\n\r\n return source.replace(/(
)?
/gi, function(match, pre) {\r\n if (pre) {\r\n return '
';\r\n } else {\r\n return '
';\r\n }\r\n });\r\n }}\r\n ];\r\n };\r\n\r\n // Client-side export\r\n if (typeof window !== 'undefined' && window.Showdown && window.Showdown.extensions) { window.Showdown.extensions.prettify = prettify; }\r\n // Server-side export\r\n if (typeof module !== 'undefined') module.exports = prettify;\r\n\r\n}());\r\n"]}
\ No newline at end of file
diff --git a/compressed/extensions/table.min.js b/compressed/extensions/table.min.js
deleted file mode 100644
index 065724a..0000000
--- a/compressed/extensions/table.min.js
+++ /dev/null
@@ -1,2 +0,0 @@
-/*! showdown 06-01-2015 */
-!function(){var a=function(a){var b,c={},d="text-align:left;";return c.th=function(a){if(""===a.trim())return"";var b=a.trim().replace(/ /g,"_").toLowerCase();return'
'+a+" "},c.td=function(b){return''+a.makeHtml(b)+" "},c.ths=function(){var a="",b=0,d=[].slice.apply(arguments);for(b;b\n",a+=c.tds.apply(this,b),a+=" \n"},b=function(a){var b,d,e=0,f=a.split("\n"),g=[];for(e;e' + header + ' ';\r\n };\r\n tables.td = function(cell) {\r\n return '' + converter.makeHtml(cell) + ' ';\r\n };\r\n tables.ths = function(){\r\n var out = \"\", i = 0, hs = [].slice.apply(arguments);\r\n for (i;i\\n\";\r\n out += tables.ths.apply(this, hs);\r\n out += \" \\n\";\r\n out += \"\\n\";\r\n return out;\r\n };\r\n tables.tr = function() {\r\n var out, i = 0, cs = [].slice.apply(arguments);\r\n out = \"\\n\";\r\n out += tables.tds.apply(this, cs);\r\n out += \" \\n\";\r\n return out;\r\n };\r\n filter = function(text) { \r\n var i=0, lines = text.split('\\n'), line, hs, rows, out = [];\r\n for (i; iMarkdown
-
- HTML
-
- Overview
-
-Philosophy
-
-Markdown is intended to be as easy-to-read and easy-to-write as is feasible.
-
-Readability, however, is emphasized above all else. A Markdown-formatted
-document should be publishable as-is, as plain text, without looking
-like it's been marked up with tags or formatting instructions. While
-Markdown's syntax has been influenced by several existing text-to-HTML
-filters -- including [Setext] [1], [atx] [2], [Textile] [3], [reStructuredText] [4],
-[Grutatext] [5], and [EtText] [6] -- the single biggest source of
-inspiration for Markdown's syntax is the format of plain text email.
-
- [1]: http://docutils.sourceforge.net/mirror/setext.html
- [2]: http://www.aaronsw.com/2002/atx/
- [3]: http://textism.com/tools/textile/
- [4]: http://docutils.sourceforge.net/rst.html
- [5]: http://www.triptico.com/software/grutatxt.html
- [6]: http://ettext.taint.org/doc/
-
-To this end, Markdown's syntax is comprised entirely of punctuation
-characters, which punctuation characters have been carefully chosen so
-as to look like what they mean. E.g., asterisks around a word actually
-look like \*emphasis\*. Markdown lists look like, well, lists. Even
-blockquotes look like quoted passages of text, assuming you've ever
-used email.
-
-
-
-Inline HTML
-
-Markdown's syntax is intended for one purpose: to be used as a
-format for *writing* for the web.
-
-Markdown is not a replacement for HTML, or even close to it. Its
-syntax is very small, corresponding only to a very small subset of
-HTML tags. The idea is *not* to create a syntax that makes it easier
-to insert HTML tags. In my opinion, HTML tags are already easy to
-insert. The idea for Markdown is to make it easy to read, write, and
-edit prose. HTML is a *publishing* format; Markdown is a *writing*
-format. Thus, Markdown's formatting syntax only addresses issues that
-can be conveyed in plain text.
-
-For any markup that is not covered by Markdown's syntax, you simply
-use HTML itself. There's no need to preface it or delimit it to
-indicate that you're switching from Markdown to HTML; you just use
-the tags.
-
-The only restrictions are that block-level HTML elements -- e.g. `