CSS selector for styling content of Sage worksheet

23 views
Skip to first unread message

Rob Beezer

unread,
Oct 1, 2016, 12:40:14 PM10/1/16
to sage-...@googlegroups.com
I'd like to heavily style the *content* of a *.sagews worksheet (a section or
chapter of a textbook, say) by load()'ing an extensive CSS file. But I don't
want to interfere with styling on button bars and other UI elements.

So I'd like to use an overall selector to prefix the more specific ones and
limit the scope to the actual input/output contents of the worksheet.

salvus-editor-codemirror-input-container-layout-1 seems to be the first one
that does not contain any of the buttons above the content, but it also includes
the left margin line numbers.

The range from CodeMirror-lines down to CodeMirror-code seem to be about
right, but it is not clear if it would make a difference which one was used.

Any recommendations?

Thanks,
Rob

Harald Schilly

unread,
Oct 1, 2016, 1:01:26 PM10/1/16
to sage-cloud
Well, since there are usually several sagews files opened, wouldn't
any change of the css to one of them have implications to all the
others? That's probably not your intention. Not sure if this can be
solved in an easy way, and might involve writing some specialized
functions for this.

-- h
> --
> You received this message because you are subscribed to the Google Groups
> "sage-cloud" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-cloud+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-cloud/MTAwMDA0MC5iZWV6ZXI.1475340012%40quikprotect.
> For more options, visit https://groups.google.com/d/optout.

William Stein

unread,
Oct 1, 2016, 1:06:16 PM10/1/16
to sage-cloud
Maybe we could use an iframe... though that might be much more
expensive (requiring loading mathjax, etc., and everything else in
there).
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-cloud/CAGG4CB6w%2BoMSE6_weTkMBCiL-rTqMvdYV7e62Vshv6pjU%2BvoUw%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.



--

Best Regards,
William Stein

CEO, SageMath, Inc.

Rob Beezer

unread,
Oct 1, 2016, 1:48:39 PM10/1/16
to sage-...@googlegroups.com
On 10/01/2016 10:00 AM, Harald Schilly wrote:
> Well, since there are usually several sagews files opened, wouldn't
> any change of the css to one of them have implications to all the
> others? That's probably not your intention.

Had not thought it through like that. I guess I was conflating an SMC tab with
a browser tab. ;-)

I only want to affect the %html cells that have textbook-content in them, and
not the actual compute cells with Sage output, etc. And I have complete control
over what goes into the HTML cell. So maybe instead, *I* should just wrap the
entire HTML cell in a div of my own and that would strike a sufficient balance
between isolation and control.

Seems chatting with you both makes me think harder. ;-) Thanks for the replies.
I'm going to experiment and will report back - so let this one sit for now.

Rob


Harald Schilly

unread,
Oct 1, 2016, 1:53:20 PM10/1/16
to sage-cloud
On Sat, Oct 1, 2016 at 7:48 PM, Rob Beezer <bee...@ups.edu> wrote:
> So maybe instead, *I* should just wrap the entire HTML cell in a div of my
> own ...

yes, this sounds like a good plan. Maybe even more general, we could
add a parameter html(class="my-own-classname") right there, to spare
you having to wrap this into a div.

but first, try to do this as a test.

-- h

Rob Beezer

unread,
Oct 1, 2016, 4:09:57 PM10/1/16
to sage-...@googlegroups.com
Thanks again for the chat, Harald and William. That approach seems to be
working - I'm seeing my CSS doing its job, and I'm not seeing various artifacts
elsewhere from when I was not being so careful. I think that will work fine on
my end.

I have the html() decorator just once in a single template (subroutine) so I
don't think I have a need for the "class=" keyword. And I'm planning to escape
the HTML into the JSON output version, so I'll need to insert it there myself as
well.

But maybe this exercise suggests it will be useful for others?

Thanks,
Rob
Reply all
Reply to author
Forward
0 new messages