KittyCAD / modeling-app

The KittyCAD modeling app.
https://kittycad.io/modeling-app/download
MIT License
376 stars 33 forks source link

Docs: Support no-visuals examples #4095

Open adamchalmers opened 1 week ago

adamchalmers commented 1 week ago

Some KCL stdlib functions, like sin(), are best documented with asserts rather than images.

E.g. this is the current documentation for sin():

Image

I believe the docs would be simpler and easier to understand if instead they just said

assertEqual(sin(0), 0)
assertEqual(sin(90), 1)
assertEqual(sin(180), 0)

with no image.

Proposed solution

KCL stdlib definitions currently require a KCL code block, and always render it as a PNG. The codeblock should optionally start with //no-png to signal its PNG shouldn't be rendered.

jessfraz commented 1 week ago

I think this is a @jgomez720 or @JordanNoone question i personally like the images

jessfraz commented 1 week ago

For history sake and context we did have a no image thing before and Josh worked to make all the samples good and I removed it

adamchalmers commented 1 week ago

Hmm OK interesting. Maybe the images would be more useful if we added annotations e.g. labels on each side showing the KCL tags for that side.

JordanNoone commented 1 week ago

I like Adam's point of them being annotated. I am a big fan of the visuals but it is sometimes hard to tell what feature is which. This would be helpful for onboarding to KCL.

jgomez720 commented 1 week ago

I'm not a huge fan of using assert just because we are making the assumption that the user understands what assert is. To be fair, I've never seen assert in coding before I saw it in KCL. But I'm a definite +1 to annotations. @franknoirot and I talked a while ago about highlighting the line of code in the code sample to denote how to use the function, but I wasn't sure how to do it, and didn't start.