You won't see this R output, but it will run. <% foo <- 'bar' %> Now foo is <%=foo%> and today is <%=format(Sys.time(),'%B %d, %Y')%>. <%# Comment -- ignored -- useful in testing. Also notice the dash-percent-gt. It chops off the trailing newline. You can add it to any percent-gt. -%> How about generating a template from a template? <%% foo <- 'fee fi fo fum' %%> foo is still <%=foo%>.