Skip to content
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

Fenced code blocks in argument documentation #3122

Closed
epage opened this issue Dec 9, 2021 · 3 comments
Closed

Fenced code blocks in argument documentation #3122

epage opened this issue Dec 9, 2021 · 3 comments
Labels
A-derive Area: #[derive]` macro API C-enhancement Category: Raise on the bar on expectations S-duplicate Status: Closed as Duplicate

Comments

@epage
Copy link
Member

epage commented Dec 9, 2021

Issue by jonhoo
Saturday Mar 02, 2019 at 20:54 GMT
Originally opened as TeXitoi/structopt#166


I have an option that I want to include some example code for (TOML specifically), but it seems like structopt (or maybe clap?) eliminates all of the newlines for it. Could we maybe detect fenced code blocks and change the newline handling rules for that segment of the help text?

#[derive(StructOpt, Debug)]
#[structopt(name = "extractor")]
struct Opt {
    /// Meta file describing the sheets.
    ///
    /// The file should be of the form:
    ///
    /// ```toml
    /// [first_file]
    /// left = [
    ///     # this is row 1 of the left-hand side page
    ///     [
    ///         # these are the tokens in row 1
    ///         "first_token",
    ///         "second_token",
    ///         # the number of columns indicates whether they are big or small
    ///         # (5 | 6 is small, <= 4 is big)
    ///         # to ignore an element, use:
    ///         "",
    ///     ],
    ///     # this is row 2 of the left page
    ///     [
    ///         # ...
    ///     ]
    /// ],
    /// right = [
    ///     # rows of right-hand side page ...
    /// ]
    /// ```
    ///
    /// Files (like `first_file`) are expected to reside adjacent to the TOML file and have a `jpg`
    /// extension.
    #[structopt(parse(from_os_str), default_value = "images/meta.toml")]
    meta: PathBuf,
}
@epage
Copy link
Member Author

epage commented Dec 9, 2021

Comment by TeXitoi
Sunday Mar 03, 2019 at 09:01 GMT


Related to #163

You'll find some workaround on this issue.

@epage epage added A-derive Area: #[derive]` macro API C-enhancement Category: Raise on the bar on expectations labels Dec 9, 2021
@pksunkara
Copy link
Member

This is a dupe of #2389. There's a lot of context in #2401 too as pointed out in that issue.

@epage
Copy link
Member Author

epage commented Dec 10, 2021

Closing in favor of #2389

@epage epage closed this as completed Dec 10, 2021
@epage epage added the S-duplicate Status: Closed as Duplicate label Jan 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-derive Area: #[derive]` macro API C-enhancement Category: Raise on the bar on expectations S-duplicate Status: Closed as Duplicate
Projects
None yet
Development

No branches or pull requests

2 participants