rauhryan
5/19/2010 - 7:34 PM

liquid-with-markdown.html

<html>
	<head>
		<script type="text/javascript" src="lib/prototype/prototype.js"></script>
		<script type="text/javascript" src="lib/showdown/showdown.js"></script>
		<script type="text/javascript" src="lib/liquid/liquid.js"></script>
		
	</head>
	<body>
	</body>	
	<script type="text/html" id="myOtherTemplate">
		hi {{ current_user }} 
		=====================	
	</script>
	<script type="text/javascript" > 
	Liquid.readTemplateFile = function (path) {
		var elem = document.getElementById(path);
		if(elem) {
			return elem.innerHTML;
		} else {
			return path + " can't be found.";
		}
	}
	var src = "{% include 'myOtherTemplate' with current_user %}";

	var tmpl = Liquid.parse( src );
	var content = tmpl.render({ current_user: '@Rauhr' });
	alert( content );
	var converter = new Showdown.converter();
	var html = converter.makeHtml( content );
	alert(html);
	</script>

</html>