rum

DenisMc 2022-12-30T09:34:16.470579Z

Hi, (hopefully) simple question about using rum. I am converting a pre-existing website template to hiccup, and using rum to render. This template has some embedded js used to control the style, for example in the header it contains markup like this:

[:header {:x-data  "{\n          navbarOpen: false,\n          dropdownOpen: false\n        }",
                                      :class  "scrolledFromTop ? 'bg-white dark:bg-dark bg-opacity-80 dark:bg-opacity-80 shadow-sticky backdrop-blur-sm' : 'bg-white dark:bg-dark' ",
                                      ::class "w-full flex items-center sticky top-0 z-50 wow fadeInUp", :data-wow-delay ".2s"} ...
Now, when this is rendered by rum the single quotes (see scrolledFromTop? _'_ ) are escaped - I don’t want them escaped, I want this markup to be left as-is. I’ve seen dangerouslySetInnerHTML, but I only want to ‘dangerously set’ inner html in a couple of places within the header, there are numerous other tags within the header that I want to be transformed as normal from hiccup. I presume there’s a simple way to accomplish this? Thanks in advance.

jf 2024-10-01T09:25:44.340599Z

hi @denis.mccarthy.kerry I know this is old... but did you ever get this resolved? I am facing the same issue here. I've got a block of text in an :x-data attribute that I would love not to be escaped

DenisMc 2024-10-01T13:52:14.474979Z

Hi @jf.slack-clojurians, this one is lost in the mists of time for me unfortunately. Looking at my current code base I don’t have an example where I get around it, so I suspect I rewrote my html in some way to get around the issue. The underlying html I was using at the time has been completely replaced in the meantime as well, so evidence is scant 🥲

jf 2024-10-01T14:24:59.169239Z

Ok. :) I know it's been a while... But I just thought to ask and check anyway. Thank you for the prompt response!

👍 1