Skip to content

Instantly share code, notes, and snippets.

@modius
Created March 28, 2013 12:01
Show Gist options
  • Save modius/5262626 to your computer and use it in GitHub Desktop.
Save modius/5262626 to your computer and use it in GitHub Desktop.
<!---
Have files showdown.js and a markdown file in the same directory.
--->
<cfscript>
manager = createObject("java", "javax.script.ScriptEngineManager").init();
jsEngine = manager.getEngineByName("js");
showdownJS = fileRead('#getDirectoryFromPath(getCurrentTemplatePath())#/showdown.js');
jsEngine.eval(showdownJS);
showdownConverter = jsEngine.eval("new Showdown.converter()");
markdownString = fileRead("#getDirectoryFromPath(getCurrentTemplatePath())#/markdown.txt");
args = [markdownString];
result = jsEngine.invokeMethod(
showdownConverter,
"makeHtml",
args
) & "";
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment