I want to document my crate and include a table in the documentation:
//! Demonstrating MarkDown tables.
//!
//! | Foo | Bar | Baz | Qux |
//! | --- | --- | --- | --- |
//! | Hail the turbofish `::<>` | Ferris for president π¦ | I can't think of any more "funny" things | oopsie |
//!
Rendering this with cargo doc
results in:
This is what I want. However, you might have noticed that the one source code line is very long. In fact, over 100 characters long. Like many Rust projects, I want to keep all my lines under 100 characters long. So I tried to break the line somehow.
All of these versions:
//! | Foo | Bar | Baz | Qux |
//! | --- | --- | --- | --- |
//! | Hail the turbofish `::<>` | Ferris for president π¦
//! I can't think of any more "funny" things | oopsie |
//! | Foo | Bar | Baz | Qux |
//! | --- | --- | --- | --- |
//! | Hail the turbofish `::<>` | Ferris for president π¦ |
//! I can't think of any more "funny" things | oopsie |
//! | Foo | Bar | Baz | Qux |
//! | --- | --- | --- | --- |
//! | Hail the turbofish `::<>` | Ferris for president π¦
//! | I can't think of any more "funny" things | oopsie |
//! | Foo | Bar | Baz | Qux |
//! | --- | --- | --- | --- |
//! | Hail the turbofish `::<>` | Ferris for president π¦ |
//! | I can't think of any more "funny" things | oopsie |
//! | Foo | Bar | Baz | Qux |
//! | --- | --- | --- | --- |
//! | Hail the turbofish `::<>` | Ferris for president π¦ \
//! I can't think of any more "funny" things | oopsie |
Results in:
What options do I have to include long table rows in my documentation without violating the line length limit?
.md
files, preparebuild.rs
to convert.md
->.rs
file (prepend//!
or///
) and useinclude!
, b) wait for Add external doc attribute to rustc or c) use nightly with rdoc. β Stingaree