From a4cc97c0657f196f8e64d229de041628fb3e6ed7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Estev=C3=A3o=20Soares=20dos=20Santos?= Date: Wed, 27 May 2015 16:03:24 +0100 Subject: [PATCH] Version bump and release --- bower.json | 2 +- compressed/extensions/github.min.js | 29 ++++++- compressed/extensions/prettify.min.js | 33 +++++++- compressed/extensions/table.min.js | 110 +++++++++++++++++++++++++- compressed/extensions/twitter.min.js | 46 ++++++++++- package.json | 3 +- 6 files changed, 213 insertions(+), 10 deletions(-) diff --git a/bower.json b/bower.json index f3fa718..8a78061 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "showdown", - "description": "JavaScript port of Markdown", + "description": "A Markdown to HTML converter written in Javascript", "homepage": "https://github.com/showdownjs/showdown", "authors": [ "John Fraser", diff --git a/compressed/extensions/github.min.js b/compressed/extensions/github.min.js index 48bbf1e..a515aaf 100644 --- a/compressed/extensions/github.min.js +++ b/compressed/extensions/github.min.js @@ -1,2 +1,27 @@ -/*! showdown 27-05-2015 */ -!function(){var a=function(a){return[{type:"lang",regex:"(~T){2}([^~]+)(~T){2}",replace:function(a,b,c,d){return""+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 +// +// Github Extension (WIP) +// ~~strike-through~~ -> strike-through +// + +(function(){ + var github = function(converter) { + return [ + { + // strike-through + // NOTE: showdown already replaced "~" with "~T", so we need to adjust accordingly. + type : 'lang', + regex : '(~T){2}([^~]+)(~T){2}', + replace : function(match, prefix, content, suffix) { + return '' + content + ''; + } + } + ]; + }; + + // Client-side export + if (typeof window !== 'undefined' && window.Showdown && window.Showdown.extensions) { window.Showdown.extensions.github = github; } + // Server-side export + if (typeof module !== 'undefined') module.exports = github; +}()); + +//# sourceMappingURL=github.min.js.map \ No newline at end of file diff --git a/compressed/extensions/prettify.min.js b/compressed/extensions/prettify.min.js index 1e057cf..0c615d7 100644 --- a/compressed/extensions/prettify.min.js +++ b/compressed/extensions/prettify.min.js @@ -1,2 +1,31 @@ -/*! showdown 27-05-2015 */ -!function(){var a=function(a){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
+//
+//  Google Prettify
+//  A showdown extension to add Google Prettify (http://code.google.com/p/google-code-prettify/)
+//  hints to showdown's HTML output.
+//
+
+(function(){
+
+    var prettify = function(converter) {
+        return [
+            { type: 'output', filter: function(source){
+
+                return source.replace(/(
)?/gi, function(match, pre) {
+                    if (pre) {
+                        return '
';
+                    } else {
+                        return '';
+                    }
+                });
+            }}
+        ];
+    };
+
+    // Client-side export
+    if (typeof window !== 'undefined' && window.Showdown && window.Showdown.extensions) { window.Showdown.extensions.prettify = prettify; }
+    // Server-side export
+    if (typeof module !== 'undefined') module.exports = prettify;
+
+}());
+
+//# sourceMappingURL=prettify.min.js.map
\ No newline at end of file
diff --git a/compressed/extensions/table.min.js b/compressed/extensions/table.min.js
index 7547c8f..ca998b7 100644
--- a/compressed/extensions/table.min.js
+++ b/compressed/extensions/table.min.js
@@ -1,2 +1,108 @@
-/*! showdown 27-05-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+="\n"},c.tr=function(){var a,b=[].slice.apply(arguments);return a="\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"),d=b.substring(1,b.length-1).split("|"),h.push(c.thead.apply(this,d)),b=f[++e],b.trim().match(/^[|]{1}[-=|: ]+[|]{1}$/)){for(b=f[++e],h.push("");b.trim().match(/^[|]{1}.*[|]{1}$/);)b=b.trim(),h.push(c.tr.apply(this,b.substring(1,b.length-1).split("|"))),b=f[++e];h.push(""),h.push(""),g.push(h.join("\n"));continue}b=f[--e]}g.push(b)}return g.join("\n")},[{type:"lang",filter:b}]};"undefined"!=typeof window&&window.Showdown&&window.Showdown.extensions&&(window.Showdown.extensions.table=a),"undefined"!=typeof module&&(module.exports=a)}();
\ No newline at end of file
+/*global module:true*/
+/*
+ * Basic table support with re-entrant parsing, where cell content
+ * can also specify markdown.
+ *
+ * Tables
+ * ======
+ *
+ * | Col 1   | Col 2                                              |
+ * |======== |====================================================|
+ * |**bold** | ![Valid XHTML] (http://w3.org/Icons/valid-xhtml10) |
+ * | Plain   | Value                                              |
+ *
+ */
+
+(function(){
+  var table = function(converter) {
+    var tables = {}, style = 'text-align:left;', filter;
+    tables.th = function(header){
+      if (header.trim() === "") { return "";}
+      var id = header.trim().replace(/ /g, '_').toLowerCase();
+      return '' + header + '';
+    };
+    tables.td = function(cell) {
+      return '' + converter.makeHtml(cell) + '';
+    };
+    tables.ths = function(){
+      var out = "", i = 0, hs = [].slice.apply(arguments);
+      for (i;i');
+          hs = line.substring(1, line.length -1).split('|');
+          tbl.push(tables.thead.apply(this, hs));
+          line = lines[++i];
+          if (!line.trim().match(/^[|]{1}[-=|: ]+[|]{1}$/)) {
+            // not a table rolling back
+            line = lines[--i];
+          }
+          else {
+            line = lines[++i];
+            tbl.push('');
+            while (line.trim().match(/^[|]{1}.*[|]{1}$/)) {
+              line = line.trim();
+              tbl.push(tables.tr.apply(this, line.substring(1, line.length -1).split('|')));
+              line = lines[++i];
+            }
+            tbl.push('');
+            tbl.push('');
+            // we are done with this table and we move along
+            out.push(tbl.join('\n'));
+            continue;
+          }
+        }
+        out.push(line);
+      }
+      return out.join('\n');
+    };
+    return [
+    {
+      type: 'lang',
+      filter: filter
+    }
+    ];
+  };
+
+  // Client-side export
+  if (typeof window !== 'undefined' && window.Showdown && window.Showdown.extensions) { window.Showdown.extensions.table = table; }
+  // Server-side export
+  if (typeof module !== 'undefined') {
+    module.exports = table;
+  }
+}());
+
+//# sourceMappingURL=table.min.js.map
\ No newline at end of file
diff --git a/compressed/extensions/twitter.min.js b/compressed/extensions/twitter.min.js
index 257f82f..ea0b3e0 100644
--- a/compressed/extensions/twitter.min.js
+++ b/compressed/extensions/twitter.min.js
@@ -1,2 +1,44 @@
-/*! showdown 27-05-2015 */
-!function(){var a=function(a){return[{type:"lang",regex:"\\B(\\\\)?@([\\S]+)\\b",replace:function(a,b,c){return"\\"===b?a:'@'+c+""}},{type:"lang",regex:"\\B(\\\\)?#([\\S]+)\\b",replace:function(a,b,c){return"\\"===b?a:'#'+c+""}},{type:"lang",regex:"\\\\@",replace:"@"}]};"undefined"!=typeof window&&window.Showdown&&window.Showdown.extensions&&(window.Showdown.extensions.twitter=a),"undefined"!=typeof module&&(module.exports=a)}();
\ No newline at end of file
+//
+//  Twitter Extension
+//  @username   ->  @username
+//  #hashtag    ->  #hashtag
+//
+
+(function(){
+
+    var twitter = function(converter) {
+        return [
+
+            // @username syntax
+            { type: 'lang', regex: '\\B(\\\\)?@([\\S]+)\\b', replace: function(match, leadingSlash, username) {
+                // Check if we matched the leading \ and return nothing changed if so
+                if (leadingSlash === '\\') {
+                    return match;
+                } else {
+                    return '@' + username + '';
+                }
+            }},
+
+            // #hashtag syntax
+            { type: 'lang', regex: '\\B(\\\\)?#([\\S]+)\\b', replace: function(match, leadingSlash, tag) {
+                // Check if we matched the leading \ and return nothing changed if so
+                if (leadingSlash === '\\') {
+                    return match;
+                } else {
+                    return '#' + tag + '';
+                }
+            }},
+
+            // Escaped @'s
+            { type: 'lang', regex: '\\\\@', replace: '@' }
+        ];
+    };
+
+    // Client-side export
+    if (typeof window !== 'undefined' && window.Showdown && window.Showdown.extensions) { window.Showdown.extensions.twitter = twitter; }
+    // Server-side export
+    if (typeof module !== 'undefined') module.exports = twitter;
+
+}());
+
+//# sourceMappingURL=twitter.min.js.map
\ No newline at end of file
diff --git a/package.json b/package.json
index 77c817b..833102f 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,7 @@
 {
   "name": "showdown",
-  "version": "0.5.3",
+  "version": "0.5.4",
+  "description": "A Markdown to HTML converter written in Javascript",
   "author": "John Fraser",
   "contributors": [
     "John Gruber",