From d60e32dd0106d7c769b6eed86c7eb687b1741cb5 Mon Sep 17 00:00:00 2001 From: benweet Date: Tue, 21 Jan 2014 23:48:21 +0000 Subject: [PATCH] Added comments support --- public/res/extensions/markdownExtra.js | 12 +++++++++++- public/res/html/markdownExtraSettingsBlock.html | 9 +++++++++ public/res/styles/main.less | 4 ++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/public/res/extensions/markdownExtra.js b/public/res/extensions/markdownExtra.js index 15ff49bf..e03e1be3 100644 --- a/public/res/extensions/markdownExtra.js +++ b/public/res/extensions/markdownExtra.js @@ -24,6 +24,7 @@ define([ "newlines", ], intraword: true, + comments: true, highlighter: "prettify" }; @@ -42,6 +43,7 @@ define([ utils.setInputChecked("#input-markdownextra-strikethrough", hasExtension("strikethrough")); utils.setInputChecked("#input-markdownextra-newlines", hasExtension("newlines")); utils.setInputChecked("#input-markdownextra-intraword", markdownExtra.config.intraword); + utils.setInputChecked("#input-markdownextra-comments", markdownExtra.config.comments); utils.setInputValue("#input-markdownextra-highlighter", markdownExtra.config.highlighter); }; @@ -56,6 +58,7 @@ define([ utils.getInputChecked("#input-markdownextra-strikethrough") && newConfig.extensions.push("strikethrough"); utils.getInputChecked("#input-markdownextra-newlines") && newConfig.extensions.push("newlines"); newConfig.intraword = utils.getInputChecked("#input-markdownextra-intraword"); + newConfig.comments = utils.getInputChecked("#input-markdownextra-comments"); newConfig.highlighter = utils.getInputValue("#input-markdownextra-highlighter"); }; @@ -76,7 +79,14 @@ define([ }; converter.setOptions(converterOptions); } - + if(markdownExtra.config.comments === true) { + converter.hooks.chain("postConversion", function(text) { + return text.replace(//g, function(wholeMatch) { + return wholeMatch.replace(/^$/, ' $1 '); + }); + }); + } + var extraOptions = { extensions: markdownExtra.config.extensions }; diff --git a/public/res/html/markdownExtraSettingsBlock.html b/public/res/html/markdownExtraSettingsBlock.html index 5ca59974..d997918d 100644 --- a/public/res/html/markdownExtraSettingsBlock.html +++ b/public/res/html/markdownExtraSettingsBlock.html @@ -35,6 +35,15 @@ +
+ +
+
+ +
+
+
diff --git a/public/res/styles/main.less b/public/res/styles/main.less index 0bb7c197..e0f8498b 100644 --- a/public/res/styles/main.less +++ b/public/res/styles/main.less @@ -1291,6 +1291,10 @@ input[type="file"] { height: 120px; } +.label.comment { + white-space: inherit; +} + /********************* * Bootstrap tour