Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render icon previews in doc comments #46

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

MrGVSV
Copy link
Contributor

@MrGVSV MrGVSV commented Apr 22, 2024

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
Ayu1 doc_icon--ayu

Footnotes

  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
Copy link
Member

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

@marc2332 marc2332 self-requested a review April 22, 2024 17:21
@marc2332 marc2332 added the enhancement New feature or request label Apr 22, 2024
@marc2332
Copy link
Member

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
Copy link
Contributor Author

MrGVSV commented Apr 28, 2024

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
Copy link
Contributor Author

MrGVSV commented May 2, 2024

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

@marc2332
Copy link
Member

marc2332 commented May 7, 2024

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
Copy link
Member

marc2332 commented May 7, 2024

It would be cool if we could have conditional docs but we can't due to rust-lang/rust#1998

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants