Fork me on GitHub
#nextjournal
<
2022-01-30
>
Carsten Behring20:01:48

How can I make clerk render a "multiline string" , like "a\nb" in multiple lines ?

mkvlr20:01:35

currently only by providing your own string viewer to override the default one https://github.com/nextjournal/clerk/blob/main/src/nextjournal/clerk/viewer.cljc#L171

Carsten Behring20:01:04

clerk/code did it for my case as well.

Carsten Behring20:01:47

even niceley, by making the numbers green ... 🙂

💚 1
mkvlr20:01:42

was thinking of making the string viewer expandable by making the quotes clickable and rendering new lines when expanded

mkvlr21:01:01

similar to the collection viewers

mkvlr21:01:19

would that be helpful in your case?

Carsten Behring21:01:56

"my concrete" case is perfectly rendered "as is". I want to see the full string. Use clerk/code is maybe a work around. In general, a way for "verbatim" full printing of strings (using newlines , if present) is useful. especial for interop with Java. Some java libraries rely on "toString" printing clerk/code could be just sthat method, it seems. (but as it does "magic", it might fail on some strings)

Carsten Behring21:01:21

Not sure, if this needs clickable expansions, or just print the full string. Maybe both:slightly_smiling_face:

Carsten Behring22:01:33

Can we have tables with horizontal scroll ? That would be a good extension of ":full"

âž• 1
Carsten Behring22:01:19

I can get it with a "trick" already know.

(clerk/html
[:span
    (clerk/table
     ..wide table
     )
]) 

Carsten Behring22:01:40

But maybe we should have a better solution

Carsten Behring22:01:50

Can we control the overall width of the output ? It was asked here: https://github.com/nextjournal/clerk/issues/54 but the answer was for "per viewer", I look more fore a global setting.