Support for GFM newlines and strikethrough

This commit is contained in:
benweet 2013-12-23 23:15:47 +01:00
parent ee2fe28e04
commit e9b468f3c3
3 changed files with 35 additions and 16 deletions

View File

@ -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");
};

View File

@ -39,7 +39,7 @@ define([
var sectionText = tmpText.substring(offset, endOffset);
sectionList.push({
text: sectionText,
textWithDelimiter: '\n~~~SectionDelimiter~~~\n\n' + sectionText + '\n'
textWithDelimiter: '\n<div class="se-section-delimiter"></div>\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(/<p>~~~SectionDelimiter~~~<\/p>/g, '<div class="se-section-delimiter"></div>');
});
};
return markdownSectionParser;

View File

@ -1,15 +1,5 @@
<p>Adds extra features to the original Markdown syntax.</p>
<div class="form-horizontal">
<div class="form-group">
<label class="col-lg-4 control-label"
for="input-markdownextra-fencedcodegfm">GFM fenced code
blocks</label>
<div class="col-lg-7">
<div class="checkbox">
<input type="checkbox" id="input-markdownextra-fencedcodegfm">
</div>
</div>
</div>
<div class="form-group">
<label class="col-lg-4 control-label" for="input-markdownextra-tables">Tables</label>
<div class="col-lg-7">
@ -54,6 +44,34 @@
</div>
</div>
</div>
<div class="form-group">
<label class="col-lg-4 control-label"
for="input-markdownextra-newlines">GFM newlines</label>
<div class="col-lg-7">
<div class="checkbox">
<input type="checkbox" id="input-markdownextra-newlines">
</div>
</div>
</div>
<div class="form-group">
<label class="col-lg-4 control-label"
for="input-markdownextra-strikethrough">GFM strikethrough</label>
<div class="col-lg-7">
<div class="checkbox">
<input type="checkbox" id="input-markdownextra-strikethrough">
</div>
</div>
</div>
<div class="form-group">
<label class="col-lg-4 control-label"
for="input-markdownextra-fencedcodegfm">GFM fenced code
blocks</label>
<div class="col-lg-7">
<div class="checkbox">
<input type="checkbox" id="input-markdownextra-fencedcodegfm">
</div>
</div>
</div>
<div class="form-group">
<label class="col-lg-4 control-label"
for="input-markdownextra-highlighter">Syntax highlighter</label>