rust-unofficial / patterns

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

do not allow tabs in code blocks #178

Closed MarcoIeni closed 3 years ago

MarcoIeni commented 3 years ago

See https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md#md010---hard-tabs

simonsan commented 3 years ago

I think markdown lint should exclude/ignore codeblocks completely and we should enforce style inside the codeblock with a cargo-fmt.toml. I already opened an upstream issue for this.

MarcoIeni commented 3 years ago

Yes, but in the meantime this is the best we can do. Should we manually check if code contains tab in the meantime?

Also, what's the point of changing markdownlint default behavior by allowing tabs in code blocks? It's a sane default imho.

simonsan commented 3 years ago

Yes, but in the meantime this is the best we can do. Should we manually check if code contains tab in the meantime?

Also, what's the point of changing markdownlint default behavior by allowing tabs in code blocks? It's a sane default imho.

Naja, because I assume people write their code in their favoured IDE and adjust the style their with cargo fmt. We could state that in contributing as well, as soon as we have a cargo-fmt.toml. That they probably write their code in an article.rs file so that it works and gets checked by rust-analyzer/RLS and run cargo fmt then copy it over. Would let markdownlint mess with Rust code.

MarcoIeni commented 3 years ago

Is rustfmt with default checks supported in mdbook at the moment? I.e. a similar code like mdbook test that checks for format.

simonsan commented 3 years ago

Is rustfmt with default checks supported in mdbook at the moment? I.e. a similar code like mdbook test that checks for format.

I opened an upstream issue for this for mdbook fmt which would be quite lovely, so i don't think so. But we could adjust the workflow given in contributing to let people know how we imagine it as mentioned above

simonsan commented 3 years ago

Upstream issue is here https://github.com/rust-lang/mdBook/issues/1422

MarcoIeni commented 3 years ago

Yeah, this is awesome and what you have written is a very good long term plan, I hope it gets implemented soon.

In the meantime you don't want to merge this? 🥺