cubing / cubing.js

🛠 A library for displaying and working with twisty puzzles. Also currently home to the code for Twizzle.
https://js.cubing.net/cubing/
GNU General Public License v3.0
245 stars 44 forks source link

[cubing.js issue] tabulations for indentation break things #337

Open bgoglin opened 1 week ago

bgoglin commented 1 week ago

Steps to reproduce the issue

Hello. This poorly indented code works fine (only spaces before non-first lines of the alg)

     <twisty-player
       alg="R // on monte la face de droite
       U // on tourne le haut vers la gauche
       R' // on baisse la face de droite
       U' // on ramène le haut vers la droite"
       experimental-setup-anchor="end"></twisty-player>

This properly indented code doesn't work (there is a tab and some spaces before non-first lines of the alg)

     <twisty-player
       alg="R // on monte la face de droite
        U // on tourne le haut vers la gauche
        R' // on baisse la face de droite
        U' // on ramène le haut vers la droite"
       experimental-setup-anchor="end"></twisty-player>

Observed behaviour

Buttons are greyed out depending on the indentation.

🖼 Screenshots

No response

Expected behaviour

Indentation should be ignored.

Environment

Firefox and Chrome on Linux.

Additional info

That's not an important issue, but it looks very strange. Thanks for this stuff anyway, it's really wondering for explaining things to beginners.

bgoglin commented 1 week ago

Looks like it's related to the tabulation character

lgarron commented 4 days ago

Hmm, yeah, we purposely support spaces for whitepsace right now. If we get a lot of feedback about this I think that wouldn't necessarily be too hard but we'd have to think carefully about implications for https://standards.cubing.net/draft/6/sign-lgn-notation/

I'll leave this issue open for at least adding a more helpful warning.

If you remove the tabs from you code, any proper HTML formatter should avoid introducing them at least.

lgarron commented 4 days ago

I'll leave this issue open for at least adding a more helpful warning.

Actually, I'm gonna generalize this into another issue.

lgarron commented 4 days ago

Closing in favor of https://github.com/cubing/cubing.js/issues/338

bgoglin commented 4 days ago

Thanks, I've indeed configured my editor to avoid tabs entirely since then. But debugging the issue was very strange at the beginning. Help messages would certainly be enough.