cubing.js icon indicating copy to clipboard operation
cubing.js copied to clipboard

[Feature request] Make Alg viewer display stylable

Open anicolao opened this issue 3 years ago • 2 comments

Goal

I'd like to be able to format the exponent properly in the alg viewer.

Possible solution

Put the exponent in its own span.

Alternatives

You could give it a CSS class too, though that's not really necessary.

PS I couldn't find a place to put a screenshot in the feature request form, though I had one prepared.

anicolao avatar Nov 03 '22 13:11 anicolao

By "exponent", do you mean e.g. the 2 in R2? Could you describe the use case for that?

<twisty-alg-viewer> is meant to support basic styling changes to fit into the context of any page, but it's also meant to display algs in a reasonably consistent way and I don't want to encourage modifications that can make the same alg look different, or (in particular) affect the text of the alg.

lgarron avatar Nov 03 '22 20:11 lgarron

I mean (U2 R2)6 --> (U2 R2)⁶ but it sounds like there might be a philosophical issue here about how much control you want the user to have over the alg string. Right now it isn't apparent it is meant to be styled at all as a different style is needed for the ()6 than for the U2 R2 (you would have seen this bug when you tried it).

I recommend either having one class that styles the whole string and insists on rendering the string its own way (and I'd still use superscripts for the exponent) or having spans or other mechanisms to enable the user to control the style of every character.

As a user of the library, I much prefer the second. It's hard not to get frustrated when it feels like more work to get the library to do what I want than to render it myself; though it is true that up to the vince viewer I had rendered all the algs myself because the behaviour built in was never quite what I needed. In this case it is almost exactly what I wanted, modulo the styling.

anicolao avatar Nov 03 '22 21:11 anicolao