Closed shiffman closed 8 years ago
or just maybe when it is built and rendered at the start, any example code inside is auto-formatted.
Sure!
We can add another option, say, data-auto-format
to the widget, that enables auto-formatting, or we could enable it by default and have data-no-auto-format
...
Out of curiosity, what's the use case for this? If it's intended primarily for authors, e.g. to workaround issues like #56, then I think there are some alternative solutions... If it's to help learners understand what well-formatted code looks like, though, that's cool!
this came up from a discussion we had with @tchoi8 where @shiffman and I were mentioning how it's helpful to use proper formatting in teaching examples. @tchoi8 mentioned that it was difficult to format the text in the widget and so we thought an auto-format call before rendering on the page might be helpful.
but looking more closely now at what's happening on the wordpress page, it actually looks ok. if you make the example in another editor and then just copy paste it onto the page, you can take advantage of all tab and auto-format capabilities of the editor you're using. so it might be overkill to build it into the widget.
Ok cool!
Yeah, one can of worms auto-formatting potentially introduces is, "what kind of style should the auto-formatter use?", which I'd love to avoid if at all possible :grin:
This came up at the p5.js working group meeting via @lmccart. Might be good to have "auto-format" with CMD-T in the widget (same as current desktop editor.)