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

Add custom CSS for pretty rustdoc alerts #158

Closed
BD103 opened this issue Oct 21, 2024 · 6 comments · Fixed by #161
Closed

Add custom CSS for pretty rustdoc alerts #158

BD103 opened this issue Oct 21, 2024 · 6 comments · Fixed by #161
Labels
A-Linter Related to the linter and custom lints C-Docs An improvement in documentation

Comments

@BD103
Copy link
Member

BD103 commented Oct 21, 2024

Alerts are fun and a nice way to separate out information. We can use custom CSS to add these to bevy_lint's documentation.

image

See #152 for a starting point on this.

@BD103 BD103 added A-Linter Related to the linter and custom lints C-Docs An improvement in documentation labels Oct 21, 2024
@mockersf
Copy link
Member

@BD103
Copy link
Member Author

BD103 commented Oct 21, 2024

This is already supported by rustdoc: https://doc.rust-lang.org/rustdoc/how-to-write-documentation.html#adding-a-warning-block

Yes, but just for warning blocks! Other alerts such as

Note

Notes

Tip

Tips

Important

Important information

Caution

And caution blocks

are not supported.

I used the CSS for .warning as inspiration for my original draft.

@mockersf
Copy link
Member

@GuillaumeGomez would there be interest in adding those to rustdoc?

@BD103
Copy link
Member Author

BD103 commented Oct 21, 2024

@GuillaumeGomez would there be interest in adding those to rustdoc?

I'd be willing to open a PR for them, if there is! My idea is:

My **Markdown** content...

<div class="rustdoc-alert rustdoc-alert-tip">
  <div class="rustdoc-alert-title">Fun Fact!</div>

  Other Markdown `content`...

</div>
image

@GuillaumeGomez
Copy link

I actually offered to add more kinds of "important block" but the team rejected the idea. You can see the discussion about it here.

@BD103
Copy link
Member Author

BD103 commented Oct 23, 2024

Got it! I'm still going to go ahead with #161 for bevy_lint, but thanks for the response. :)

@BD103 BD103 added this to the `bevy_lint` 0.2.0 milestone Oct 31, 2024
@BD103 BD103 closed this as completed in #161 Nov 6, 2024
BD103 added a commit that referenced this issue Nov 6, 2024
Closes #158, extracted from #152, will be used in #109.

This adds pretty alerts in `rustdoc` for `bevy_lint` that will be used
in #109 when writing `bevy_lint`'s user documentation.

<img width="908" alt="alerts in light mode"
src="https://github.com/user-attachments/assets/4ee666f2-bb85-40de-b0f6-19b7a19a45e9">

<img width="908" alt="alerts in dark mode"
src="https://github.com/user-attachments/assets/67ce7308-175c-4673-9c1e-7f89c59c4c73">

<img width="908" alt="alerts in dark mode, with the ayu theme"
src="https://github.com/user-attachments/assets/e2de4717-bc63-4d1d-bb88-83714b3cf530">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Linter Related to the linter and custom lints C-Docs An improvement in documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants