dioxus-community / dioxus-free-icons

Use free svg icons in your Dioxus projects easily with dioxus-free-icons.
Other
67 stars 15 forks source link

Render icon previews in doc comments #46

Open MrGVSV opened 2 months ago

MrGVSV commented 2 months ago

Adds the ability to have icons rendered in the doc comments of their respective type.

I put it behind a default render feature in case anyone using this crate locally wants to opt-out of this behavior. But if it's better to not be a default feature or not be a feature at all, please let me know and I can change it!

Screenshots

Theme Preview
Light doc_icon--light
Dark doc_icon--dark
Ayu[^1] doc_icon--ayu

[^1]: Definitely not the prettiest, however, I'm not sure there's a good way of swapping the color based on the theme. And we can't just add a stroke as some icons are purely stroke.

marc2332 commented 2 months ago

This is magic. I can't believe you actually did this

marc2332 commented 2 months ago

I put it behind a default render feature in case anyone using this crate locally wants to opt-out of this behavior.

Good idea! Although I would probably name the feature another way, render sounds too generic. What about preview-icons ?

MrGVSV commented 2 months ago

I put it behind a default render feature in case anyone using this crate locally wants to opt-out of this behavior.

Good idea! Although I would probably name the feature another way, render sounds too generic. What about preview-icons ?

Yeah that's probably a better name. I'll update it!

MrGVSV commented 2 months ago

Sorry for the delay! I updated the feature name :)

marc2332 commented 2 months ago

Hold on a second, having a crate feature doesn't make sense because it's in the codegen crate, which is not used by the users, hence it's kinda pointless. I'd say we remove it and just ship the preview icons always

marc2332 commented 2 months ago

It would be cool if we could have conditional docs but we can't due to https://github.com/rust-lang/rust/issues/1998