rust-unofficial / patterns

A catalogue of Rust design patterns, anti-patterns and idioms
https://rust-unofficial.github.io/patterns/
Mozilla Public License 2.0
7.87k stars 356 forks source link

Extra blank line on code block #155

Open pickfire opened 3 years ago

pickfire commented 3 years ago

image

https://rust-unofficial.github.io/patterns/functional/index.html

The extra blank line look weird.

simonsan commented 3 years ago

I don't see much configuration options for that case under output.html.playground. Probably possible to influence via Custom.js/Custom.css but not sure if this is the scope of this project. Maybe more an upstream issue to get a setting for it and a bit of personal preference.

pickfire commented 3 years ago

Yeah, after I create the issue I noticed that it doesn't seemed to be an issue for this repo. I thought that it was somehow changed here, I didn't track the change for mdbook so most likely they changed it somewhere.

But weird, their examples does not have the blank lines.

image

https://rust-lang.github.io/mdBook/format/theme/syntax-highlighting.html

simonsan commented 3 years ago

Please keep us updated if it's an issue we could fix easily with js/css/theme-based approach. ;-)

simonsan commented 3 years ago

2021-01-05 11_24_09-Window-Screenshot

Fixed. Don't asked me why. :-) Feel free to reopen if it isn't fixed on your side still.

simonsan commented 3 years ago

mem-replace

2021-01-05 21_41_39-mem__replace(_) - Rust Design Patterns – Mozilla Firefox-Screenshot

dtor-finally 2021-01-05 21_42_05-Finalisation in Destructors - Rust Design Patterns – Mozilla Firefox-Screenshot

on-stack-dyn-dispatch 2021-01-05 21_42_27-On-Stack Dynamic Dispatch - Rust Design Patterns – Mozilla Firefox-Screenshot

:-D

Reopening.

MarcoIeni commented 3 years ago

Should we keep this opened? I mean that's something that we cannot control..

simonsan commented 3 years ago

Should we keep this opened? I mean that's something that we cannot control..

Yeah, I would keep it open as an upstream issue to track. Seeing three different variants in the book I'm also interested now what's going on there, so I would prefer to leave it open.

simonsan commented 3 years ago

Tracking: https://github.com/rust-lang/mdBook/issues/1433

pickfire commented 3 years ago

I think in some cases it puts an empty space but in some cases it does not, so weird.

I believe adding # fn main() there is no new line. As mentioned by dtolnay. https://github.com/rust-lang/mdBook/issues/1433#issuecomment-755848991

MarcoIeni commented 3 years ago

Ok, but I prefer to wait for the actual fix instead of adding # fn main() all over the place.