Skip to content

Instantly share code, notes, and snippets.

@chrisjhoughton
Created March 6, 2014 13:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisjhoughton/9390050 to your computer and use it in GitHub Desktop.
Save chrisjhoughton/9390050 to your computer and use it in GitHub Desktop.
DO NOT USE. CURRENTLY BUGGY. An extremely useful yet nasty function to pass native HTML into a JavaScript function. Compatible with IE8+
var multiline = function (fn) {
var reCommentContents = /\/\*\s*([\s\S]*?)\s*\*\//;
return reCommentContents.exec(fn.toString())[1];
};
var html = multiline(function(){/*
<div>
<marquee>HELLO</marquee>
</div>
*/});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment