Vitaly Puzrin
10 years ago
7 changed files with 79 additions and 87 deletions
@ -1,4 +1,3 @@ |
|||
benchmark/implementations/ |
|||
demo/ |
|||
dist/ |
|||
node_modules/ |
|||
|
@ -0,0 +1,6 @@ |
|||
env: |
|||
node: false |
|||
browser: true |
|||
|
|||
globals: |
|||
$: false |
@ -1,32 +1,51 @@ |
|||
$(function() { |
|||
// highlight snippets
|
|||
$('pre.code-sample code').each(function(i, block) { |
|||
hljs.highlightBlock(block); |
|||
}); |
|||
}); |
|||
(function () { |
|||
'use strict'; |
|||
|
|||
var mdHtml, mdSrc; |
|||
|
|||
var options = { |
|||
html: true, |
|||
xhtml: true, |
|||
breaks: false, |
|||
langprefix: 'language-' |
|||
}; |
|||
|
|||
var md = new window.Remarkable({ |
|||
html: true, |
|||
xhtml: true, |
|||
breaks: false, |
|||
langprefix: 'language-' |
|||
}); |
|||
function mdInit() { |
|||
mdHtml = new window.Remarkable(options); |
|||
mdSrc = new window.Remarkable(options); |
|||
|
|||
md.renderer.rules.table_open = function () { |
|||
return '<table class="table table-striped">\n'; |
|||
} |
|||
// Beautify output of parser for html content
|
|||
mdHtml.renderer.rules.table_open = function () { |
|||
return '<table class="table table-striped">\n'; |
|||
}; |
|||
} |
|||
|
|||
function updateResult() { |
|||
var source = $('.source').val(); |
|||
$('.result').html(mdHtml.render(source)); |
|||
$('.result-src-content').text(mdSrc.render(source)); |
|||
} |
|||
|
|||
function updateResult() { |
|||
var result = md.render($('#demo1 .source').val()); |
|||
$('#demo1 .result').html(result); |
|||
$('#demo1 .result-text-data').text(result); |
|||
} |
|||
|
|||
$('#demo1 .source').on('keyup paste cut mouseup', updateResult); |
|||
$('#demo1 .mode').on('click', function (event) { |
|||
$('#demo1').toggleClass('result-as-text'); |
|||
event.preventDefault(); |
|||
}); |
|||
$(function() { |
|||
// highlight snippet
|
|||
$('pre.code-sample code').each(function(i, block) { |
|||
window.hljs.highlightBlock(block); |
|||
}); |
|||
|
|||
updateResult(); |
|||
mdInit(); |
|||
|
|||
$('.source').on('keyup paste cut mouseup', updateResult); |
|||
$('.source-clear').on('click', function (event) { |
|||
$('.source').val(''); |
|||
updateResult(); |
|||
event.preventDefault(); |
|||
}); |
|||
$('.result-mode').on('click', function (event) { |
|||
$('body').toggleClass('result-as-text'); |
|||
event.preventDefault(); |
|||
}); |
|||
|
|||
updateResult(); |
|||
}); |
|||
})(); |
|||
|
Loading…
Reference in new issue