From e9b468f3c3b370790d6a431a33536c6e8dec32e0 Mon Sep 17 00:00:00 2001 From: benweet Date: Mon, 23 Dec 2013 23:15:47 +0100 Subject: [PATCH] Support for GFM newlines and strikethrough --- public/res/extensions/markdownExtra.js | 6 +++ .../res/extensions/markdownSectionParser.js | 7 +--- .../res/html/markdownExtraSettingsBlock.html | 38 ++++++++++++++----- 3 files changed, 35 insertions(+), 16 deletions(-) diff --git a/public/res/extensions/markdownExtra.js b/public/res/extensions/markdownExtra.js index b3e2678e..ff13c4c4 100644 --- a/public/res/extensions/markdownExtra.js +++ b/public/res/extensions/markdownExtra.js @@ -20,6 +20,8 @@ define([ "attr_list", "footnotes", "smartypants", + "strikethrough", + "newlines", ], highlighter: "prettify" }; @@ -36,6 +38,8 @@ define([ utils.setInputChecked("#input-markdownextra-attrlist", hasExtension("attr_list")); utils.setInputChecked("#input-markdownextra-footnotes", hasExtension("footnotes")); utils.setInputChecked("#input-markdownextra-smartypants", hasExtension("smartypants")); + utils.setInputChecked("#input-markdownextra-strikethrough", hasExtension("strikethrough")); + utils.setInputChecked("#input-markdownextra-newlines", hasExtension("newlines")); utils.setInputValue("#input-markdownextra-highlighter", markdownExtra.config.highlighter); }; @@ -47,6 +51,8 @@ define([ utils.getInputChecked("#input-markdownextra-attrlist") && newConfig.extensions.push("attr_list"); utils.getInputChecked("#input-markdownextra-footnotes") && newConfig.extensions.push("footnotes"); utils.getInputChecked("#input-markdownextra-smartypants") && newConfig.extensions.push("smartypants"); + utils.getInputChecked("#input-markdownextra-strikethrough") && newConfig.extensions.push("strikethrough"); + utils.getInputChecked("#input-markdownextra-newlines") && newConfig.extensions.push("newlines"); newConfig.highlighter = utils.getInputValue("#input-markdownextra-highlighter"); }; diff --git a/public/res/extensions/markdownSectionParser.js b/public/res/extensions/markdownSectionParser.js index 7366b356..f2a5f974 100644 --- a/public/res/extensions/markdownSectionParser.js +++ b/public/res/extensions/markdownSectionParser.js @@ -39,7 +39,7 @@ define([ var sectionText = tmpText.substring(offset, endOffset); sectionList.push({ text: sectionText, - textWithDelimiter: '\n~~~SectionDelimiter~~~\n\n' + sectionText + '\n' + textWithDelimiter: '\n
\n\n' + sectionText + '\n' }); } var sectionList = [], offset = 0; @@ -56,11 +56,6 @@ define([ return result + section.textWithDelimiter; }, ''); }); - - converter.hooks.chain("postConversion", function(text) { - // Convert delimiters into hidden elements - return text.replace(/

~~~SectionDelimiter~~~<\/p>/g, '

'); - }); }; return markdownSectionParser; diff --git a/public/res/html/markdownExtraSettingsBlock.html b/public/res/html/markdownExtraSettingsBlock.html index 5b65213f..f07b10ac 100644 --- a/public/res/html/markdownExtraSettingsBlock.html +++ b/public/res/html/markdownExtraSettingsBlock.html @@ -1,15 +1,5 @@

Adds extra features to the original Markdown syntax.

-
- -
-
- -
-
-
@@ -54,6 +44,34 @@
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+