From 76984e87ac4d316fd93eef01695ef7fee50522ba Mon Sep 17 00:00:00 2001 From: David Greenspan Date: Tue, 28 Aug 2012 10:17:06 -0700 Subject: [PATCH] Further hack docs Markdown for Spark --- docs/client/docs.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/client/docs.js b/docs/client/docs.js index c7dc28497e..682f3cfaf8 100644 --- a/docs/client/docs.js +++ b/docs/client/docs.js @@ -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, ''); 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; });