-
Notifications
You must be signed in to change notification settings - Fork 402
[Merged by Bors] - Add incorrect code block support #348
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
Conversation
|
I would have loved to do something like ```rust,{.incorrect}
[CONTENT GOES HERE]
```or something to that effect, but that breaks syntax highlighting. This was the best option that I found to get this feature working. It works by having a shortcode just add a Maybe someone can fancy it up by adding Bevy icons or summat to the div like the Rust docs, but this is just an MVP (and my first PR here). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The solution looks good. 👍
The only thing, I think the styles should go in another file. Check the comment.
sass/elements/_html.scss
Outdated
| div.incorrect { | ||
| background-color: #542326; | ||
| border-left: 10px solid red; | ||
| border-radius: 10px; | ||
|
|
||
| .z-code, | ||
| .z-code code { | ||
| background-color: #542326; | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think is better to put this snippet in components/_syntax-theme.scss which is where all the syntax highlighting styles are. This file (html.scss) should be only for html element tweaks (although it also touches body right now, this is fixed in #315).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I've moved it~
|
Btw, maybe an issue can be opened in Zola to allow adding extra classes into code blocks? They already have some annotations, maybe it's not difficult for them to add this option. See: https://www.getzola.org/documentation/content/syntax-highlighting/#annotations |
|
Hi! Now that I see it again, I think the PR should contain only the actual changes, not the code formatting changes. But, that's my opinion, I don't know what's the Bevy policy here. |
|
Ok, I've undone all the formatting for _html.scss, but _syntax-theme.scss didn't have a consistent space formatting (the properties are sometimes 1 space, sometimes 4.) I could undo the selector formatting. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, makes sense for syntax-theme file. 👌
|
Yeah, we should try to fix and enforce formatting issues in a seperate PR if possible. |
|
bors r+ |
This should resolve #343 by adding a shortcode that goes around code blocks that should be marked incorrect (`incorrect_code_block()`), highlights them in a dark red, and makes the left border red. Looks like this: <img width="1213" alt="Screen Shot 2022-04-16 at 4 50 25 PM" src="https://user-images.githubusercontent.com/1479994/163690976-77abfe98-fd71-4988-afcb-02e3be35491a.png"> from: ~~~markdown Just keep in mind that `&World` will conflict with _any_ mutable Query: {% incorrect_code_block() %} ```rust fn invalid_system(world: &World, transforms: Query<&mut Transform>) { } ``` {% end %} In these cases, consider using our new [ParamSets](/news/bevy-0-7/#paramsets) to resolve the conflict: ```rust fn valid_system(set: ParamSet<(&World, Query<&mut Transform>)>) { } ``` ~~~
|
Pull request successfully merged into master. Build succeeded: |
This should resolve #343 by adding a shortcode that goes around code blocks that should be marked incorrect (

incorrect_code_block()), highlights them in a dark red, and makes the left border red. Looks like this:from: