updating showdown library, adding support for tables and strikethrough,

fixing issue with double escaping HTML entities that was causing
blockquotes to be ignored, fixes #75
This commit is contained in:
El RIDO 2016-05-22 16:18:57 +02:00
parent 7f2fd4d980
commit 1625aac798
9 changed files with 19 additions and 1313 deletions

View file

@ -560,17 +560,23 @@ $(function() {
* use given format on paste, defaults to plain text
*
* @param string format
* @param string text
*/
formatPaste: function(format)
formatPaste: function(format, text)
{
helper.setElementText(this.clearText, text);
helper.setElementText(this.prettyPrint, text);
switch (format || 'plaintext')
{
case 'markdown':
if (typeof Showdown == 'object')
if (typeof showdown == 'object')
{
var converter = new Showdown.converter();
showdown.setOption('strikethrough', true);
showdown.setOption('tables', true);
showdown.setOption('tablesHeaderId', true);
var converter = new showdown.Converter();
this.clearText.html(
converter.makeHtml(this.clearText.html())
converter.makeHtml(text)
);
this.clearText.removeClass('hidden');
}
@ -647,9 +653,7 @@ $(function() {
this.passwordInput.val(password);
if (cleartext.length > 0)
{
helper.setElementText(this.clearText, cleartext);
helper.setElementText(this.prettyPrint, cleartext);
this.formatPaste(paste.meta.formatter);
this.formatPaste(paste.meta.formatter, cleartext);
}
}
catch(err)
@ -990,10 +994,7 @@ $(function() {
// We pre-select the link so that the user only has to [Ctrl]+[c] the link.
helper.selectText('pasteurl');
zerobin.showStatus('', false);
helper.setElementText(zerobin.clearText, zerobin.message.val());
helper.setElementText(zerobin.prettyPrint, zerobin.message.val());
zerobin.formatPaste(data_to_send.formatter);
zerobin.formatPaste(data_to_send.formatter, zerobin.message.val());
}
else if (data.status==1)
{