This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-10-13
Channels
- # ai (5)
- # announcements (4)
- # babashka (34)
- # beginners (78)
- # biff (6)
- # calva (41)
- # cider (47)
- # clerk (1)
- # clj-commons (3)
- # clj-http (1)
- # clojure (72)
- # clojure-europe (51)
- # clojure-nl (1)
- # clojure-norway (87)
- # clojure-romania (1)
- # clojure-uk (5)
- # clojuredesign-podcast (2)
- # community-development (1)
- # conjure (2)
- # cursive (11)
- # datomic (6)
- # docker (4)
- # emacs (13)
- # exercism (20)
- # hyperfiddle (56)
- # matrix (6)
- # membrane (4)
- # nbb (11)
- # off-topic (88)
- # pathom (7)
- # pedestal (1)
- # polylith (20)
- # portal (16)
- # practicalli (1)
- # re-frame (13)
- # reagent (4)
- # reitit (2)
- # remote-jobs (7)
- # shadow-cljs (49)
- # sql (4)
I’m sending a bunch of strings to portal that I’d like to be formatted as :portal.view/code
by default. Of course, since they’re strings, I can’t attach metadata to them. Is there some metadata-capable container that I can put them in which will display as strings in portal?
I think you might be looking for this guide https://cljdoc.org/d/djblue/portal/0.48.0/doc/guides/default-viewer. I'm planning on releasing an updated version of the https://github.com/djblue/portal/blob/master/src/portal/viewer.cljc#L14-L26 ns which contains this pattern so you don't have to think about it.
Yeah, I saw this but it seemed like just a bit more work than I was wiling to put in just to save a few mouse clicks.
I shouldn’t be this lazy 🙂 Thanks!
Something like this:
(portal.console/debug ^:portal.viewer/code (portal.console/metadata-container "my code string")
That might cause issues with the current semantics of the viewer key which is to pass options to the viewer. For example:
{:portal.viewer/default :portal.viewer/table
:portal.viewer/table {:columns [:a :b :c]}}
Sorry, my example was bad. It should have been :
(portal.console/debug ^{:portal.viewer/default :portal.viewer/code} (portal.console/metadata-container "my code string")
As you can see (I hope), I’m just looking for a container to which I can attach metadata. I’d like the portal viewer to visualize the value within the container
Could you put your strings in vectors and attach metadata to that? (I don't know what the code viewer would do with that tho')
ah! that does it
disregard - I got a little too excited
Portal does not display the string in code format
But it occurs to me I could stuff the string into some hiccup and put the metadata on the hiccup vector.
fwiw, my specific use case is generating SQL strings from honey, prettifying them using a formatter, looking at them in portal and copy & pasting the string into my sql editor
It’s a very nice workflow, although I wish I had a way of sending them directly to my sql editor (this has nothing to do with portal, however)