Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure width of output? #54

Closed
mars0i opened this issue Jan 13, 2022 · 5 comments
Closed

Configure width of output? #54

mars0i opened this issue Jan 13, 2022 · 5 comments

Comments

@mars0i
Copy link

mars0i commented Jan 13, 2022

It seems as if clerk sets the width of the output in the browser to about 800 pixels for text, and about 700 pixels for Vega-Lite images. The images scroll, which is good, but I'd like to be able to make the displayed image width wider. I wouldn't mind being able to do the same with text, too, but I'm more concerned about Vega-Lite width.

i.e. it would be useful to be able to configure the output widths in the browser. Maybe there's a variable or function to do that already. I've looked for it in the docs and source, but haven't found it.

After working on this for a bit, I don't think the width constraint is coming from Vega-Lite or Hanami (which is what I'm using to generate Vega-Lite). I think the width constraint is either in some CSS used by clerk, or some of other code used to generate the output--either in clerk or a library it uses. I looked at the generated HTML in the browser, but it's not very informative. I think it comes from this function. There's a "clerk" div--maybe that's what the width constraint is attached to--but I don't know how to figure out how that's happening. I looked at the CSS files that that function uses, but nothing in them that I could recognize was the source of the width constraint. But I don't know CSS well, even for formatted code.

Thanks. Not urgent, but it would be nice to be able to configure this.

@mars0i
Copy link
Author

mars0i commented Jan 14, 2022

(If you'd like details of what I have tried, it's described here: https://clojurians.zulipchat.com/#narrow/stream/151924-data-science/topic/clerk.20questions .)

@mk
Copy link
Member

mk commented Jan 14, 2022

You can control the width via the :nextjournal/width with values :full or :wide, https://snapshots.nextjournal.com/clerk/build/3b17f691eab52d963830647591707cc8a74136be/index.html#/notebooks/viewers/image_layouts.clj should have examples.

@mars0i
Copy link
Author

mars0i commented Jan 14, 2022

Excellent. Thank you!! I will play around with that. Might have a followup question or two.

@mk
Copy link
Member

mk commented Jan 28, 2022

Btw as of 20afc21 you can also use :nextjournal.clerk/width or once you've aliased clerk ::clerk/width both on metadata and consistently as an options map for all viewer functions (added in cf468cf).

Going to close this issue. Let me know if there still things you need.

@mk mk closed this as completed Jan 28, 2022
@mars0i
Copy link
Author

mars0i commented Jan 28, 2022

Great--thanks very much @mk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants