You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gnzlbg opened this issue
Jun 19, 2016
· 4 comments
Labels
A-lintArea: New lintsE-mediumCall for participation: Medium difficulty level problem and requires some initial experience.L-styleLint: Belongs in the style lint groupT-ASTType: Requires working with the AST
The Rust book delimits documentation snippets for examples with ``` but ~~~ seems to work as well. Maybe we should have a new lint to tell people to use one over the other or at least to enforce a consistent stype within a crate.
E.g. this
/// Adds one to the number given.////// # Examples////// ```/// let five = 5;////// assert_eq!(6, add_one(5));/// # fn add_one(x: i32) -> i32 {/// # x + 1/// # }/// ```fnadd_one(x:i32) -> i32{
x + 1}
vs
/// Adds one to the number given.////// # Examples////// ~~~/// let five = 5;////// assert_eq!(6, add_one(5));/// # fn add_one(x: i32) -> i32 {/// # x + 1/// # }/// ~~~fnadd_one(x:i32) -> i32{
x + 1}
The text was updated successfully, but these errors were encountered:
Is there any difference between the two forms or is this yet another markdown way to write the same thing? The ````` style seems to be preferred, a lint to enforce consistency would be nice.
I also note that the current markdown lint should support ~~~ then.
Cc #1007.
mcarton
added
E-medium
Call for participation: Medium difficulty level problem and requires some initial experience.
T-AST
Type: Requires working with the AST
A-lint
Area: New lints
L-style
Lint: Belongs in the style lint group
labels
Jun 19, 2016
If this is added, it might be useful to also tell people to set the code block language (mentioned in #1007 as well). While rustdoc automatically sets the language to 'rust' for un-annotated code blocks, it should be preferred to be explicit (and to e.g. set "plain" to not highlight code blocks).
Is the syntax ~~~ deprecated? If so we can just recommend using . Otherwise I don't know if it would be better to still recommend using or to recommend consistency independently of the style used (e.g. by inferring the style most commonly used within a crate).
A-lintArea: New lintsE-mediumCall for participation: Medium difficulty level problem and requires some initial experience.L-styleLint: Belongs in the style lint groupT-ASTType: Requires working with the AST
The Rust book delimits documentation snippets for examples with ``` but ~~~ seems to work as well. Maybe we should have a new lint to tell people to use one over the other or at least to enforce a consistent stype within a crate.
E.g. this
vs
The text was updated successfully, but these errors were encountered: