3

I'm becoming a huge fan of CoffeeKup, but I'm wondering how I can use literal HTML in such a template? For example when I just want to copy-paste some existing, non-CoffeeKup markup.

nicolaskruchten
  • 22,120
  • 8
  • 63
  • 84

2 Answers2

5

You can add arbitrary text with the text function:

text '<p>foo</p>'

For multiline strings, CoffeeScript's heredocs are a pleasure:

text '''
  <table>
    <tr>
      <td>Foo</td>
    </tr>
  </table>
'''

Just make sure you have autoescape set to false (the default value).

Maurice
  • 261
  • 1
  • 3
  • You're welcome! I also started working on a CoffeeKup [reference](https://github.com/mauricemach/coffeekup/blob/master/docs/reference.md) if you're interested. – Maurice Jul 29 '11 at 07:43
0

Have you tried using this tool too for converting your markup instead of just inlining in?

https://github.com/brandonbloom/html2coffeekup

It's linked from the main github page of coffeekup. If it handles your old markup it would be a more elegant solution.

ivarni
  • 16,622
  • 16
  • 75
  • 89