Search code examples
ruby-on-rails-3pagedown

PageDown output as HTML unexpected token ;


I'm trying to show the results from my PageDown textarea on the show view in rails. The example I am following is here: http://code.google.com/p/pagedown/wiki/PageDown

<script type="text/javascript">
var converter = new Markdown.getSanitizingConverter();
document.write(converter.makeHtml("<%= j @joboffer.tasks.to_s %>");
</script>

However, there is a javascript error, stating that ; is unexpected. My output, shortened, looks like this:

..(converter.makeHtml("Aufgaben  \n\n - Zusatzleistungen\n          ");

It doesn't really matter what I insert into the database, the code gets accepted during edit, but nothing whatsoever is shown in show. What am I doing wrong?


Solution

  • Stupid me. Forgot to close one more bracket before the last ; Time for bed.

    Also, there is a typo in the PageDown documentation:

    document.write(converter.makeHtml("<script>alert(42);</script><b>bold"); 
    

    Missing one ) towards the end at the sanitizer example: http://code.google.com/p/pagedown/wiki/PageDown