Further hack docs Markdown for Spark

This commit is contained in:
David Greenspan
2012-08-28 10:17:06 -07:00
parent 6f8f08714b
commit 76984e87ac

View File

@@ -321,6 +321,13 @@ Handlebars.registerHelper('better_markdown', function(fn) {
return result;
};
// This is a tower of terrible hacks.
// Replace Spark annotations <$...> ... </$...> with HTML comments, and
// space out the comments on their own lines. This keeps them from
// interfering with Markdown's paragraph parsing.
// Really, running Markdown multiple times on the same string is just a
// bad idea.
input = input.replace(/<(\/?\$.*?)>/g, '<!--$1-->');
input = input.replace(/<!--.*?-->/g, '\n\n$&\n\n');
var hashedBlocks = {};
@@ -370,6 +377,8 @@ Handlebars.registerHelper('better_markdown', function(fn) {
return hashedBlocks[a];
});
output = output.replace(/<!--(\/?\$.*?)-->/g, '<$1>');
return output;
});