com-lihaoyi / scalatags

ScalaTags is a small XML/HTML construction library for Scala.
https://com-lihaoyi.github.io/scalatags/
MIT License
758 stars 117 forks source link

script encodes js text passed to it #168

Closed rpeszek closed 5 years ago

rpeszek commented 7 years ago

Hi, I have been playing with your library and I noticed that script() tries to html encode string passed to it. Should I be passing something else than String to it?

Your examples http://www.lihaoyi.com/scalatags/ show passing String directly.

scala> import scalatags.Text.all._
scala> script("var x =\"test\"").render
res1: String = <script>var x =&quot;test&quot;</script>
Semptic commented 6 years ago

Hey,

its a little bit late, but you could use raw (e.g. script(raw("""var x = "test";"""))). For more information look in the docs: http://www.lihaoyi.com/scalatags/#Auto-escapingandunsanitizedInput