summaryrefslogtreecommitdiff
path: root/public/js/extra.js
diff options
context:
space:
mode:
authorCheng-Han, Wu2016-02-11 14:35:25 -0600
committerCheng-Han, Wu2016-02-11 14:35:25 -0600
commit8db142554fbe1c85aa8ffcdf0900b2855645939b (patch)
treeac1dea5d763f20a6138edfe51a4867953ccee92b /public/js/extra.js
parent2a774064afecc7c7880a6e91467b7ad755e8f681 (diff)
Updated rendering operations to improve performance
Diffstat (limited to 'public/js/extra.js')
-rw-r--r--public/js/extra.js14
1 files changed, 5 insertions, 9 deletions
diff --git a/public/js/extra.js b/public/js/extra.js
index a2ae83f6..28a91fbc 100644
--- a/public/js/extra.js
+++ b/public/js/extra.js
@@ -338,13 +338,6 @@ function finishView(view) {
//only static transform should be here
function postProcess(code) {
var result = $('<div>' + code + '</div>');
- //prevent XSS
- result.find("script").replaceWith(function () {
- return "<noscript>" + $(this).html() + "</noscript>"
- });
- result.find("iframe").replaceWith(function () {
- return "<noiframe>" + $(this).html() + "</noiframe>"
- });
//link should open in new window or tab
result.find('a:not([href^="#"]):not([target])').attr('target', '_blank');
//update continue line numbers
@@ -576,11 +569,11 @@ function autoLinkify(view) {
}
function deduplicatedHeaderId(view) {
- var headers = view.find(':header').toArray();
+ var headers = view.find(':header.raw').removeClass('raw').toArray();
for (var i = 0; i < headers.length; i++) {
var id = $(headers[i]).attr('id');
if (!id) continue;
- var duplicatedHeaders = view.find(':header[id=' + id + ']').toArray();
+ var duplicatedHeaders = view.find(':header[id="' + id + '"]').toArray();
for (var j = 0; j < duplicatedHeaders.length; j++) {
if (duplicatedHeaders[j] != headers[i]) {
var newId = id + j;
@@ -685,6 +678,9 @@ md.renderer.rules.list_item_open = function ( /* tokens, idx, options, env */ )
md.renderer.rules.blockquote_open = function (tokens, idx /*, options, env */ ) {
return '<blockquote class="raw">\n';
};
+md.renderer.rules.heading_open = function (tokens, idx) {
+ return '<h' + tokens[idx].hLevel + ' class="raw">';
+};
md.renderer.rules.fence = function (tokens, idx, options, env, self) {
var token = tokens[idx];
var langClass = '';