This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-09-30
Channels
- # ai (3)
- # beginners (86)
- # boot (3)
- # chestnut (1)
- # cider (29)
- # clara (2)
- # cljs-dev (18)
- # cljsrn (1)
- # clojure (104)
- # clojure-greece (3)
- # clojure-losangeles (1)
- # clojure-spec (2)
- # clojure-uk (1)
- # clojurescript (5)
- # core-async (5)
- # css (3)
- # emacs (3)
- # figwheel (7)
- # fulcro (60)
- # lein-figwheel (3)
- # luminus (4)
- # off-topic (7)
- # portkey (14)
- # reagent (12)
- # rum (1)
- # shadow-cljs (9)
Can't find the words to search for the answer to this. How do you put content with newlines in a div, and convert newlines to <br/>. Or is there a better solution for displaying multi-line user entered content?
@stvnmllr2 [:pre]
preserves whitespace
Maybe this is also helpful?
Bet you could get a pre to wrap with css, though
white-space: pre-wrap
(it is css rule)
Thanks. That does seem to work. Pre with css. Now.. looking at the markdown cljs to see how to handle other types of user entered content.
Went back to the markdown example, and they use :dangerouslySetInnerHTML of react. So I guess that is an alternative if to create html content and put it in your hiccup:
[:div {:dangerouslySetInnerHTML
{:__html (md->html help)}}]
Yes, or convert newlines to hiccup
(into [:div] (interpose [:br] (str/split "\n" string-with-newlines)))