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

leading whitespace when including file snippets #1430

Open
jadamcrain opened this issue Jan 5, 2021 · 0 comments
Open

leading whitespace when including file snippets #1430

jadamcrain opened this issue Jan 5, 2021 · 0 comments
Labels
A-link-preprocessor Area: Link preprocessor, #{{include}}, etc.

Comments

@jadamcrain
Copy link

jadamcrain commented Jan 5, 2021

We would like to construct our documentation for multi-language libraries Rust -> C FFI -> Java, C#, etc using
mdbook. One issue that is kind of a deal-breaker for us is that when including snippets from source files, leading white-space is preserved:

    runtime_config_t runtime_config =
    {
        .num_core_threads = 4,
    };
    runtime_t* runtime = runtime_new(&runtime_config);

Ideally, leading white-space could normalized such that the level of indentation is dropped such that the line in the snippet containing the least white-space now contains no white-space:

runtime_config_t runtime_config =
{
    .num_core_threads = 4,
};
runtime_t* runtime = runtime_new(&runtime_config);

I would think that only pretty trivial examples have code snippets with no leading white-space and that if we do a PR it would be valuable to others.

Looking at the codebase, it seems we would be working in links preprocessor, correct?

Questions:

  1. If we do a PR, will it be considered?
  2. If so, should the behavior be configurable?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-link-preprocessor Area: Link preprocessor, #{{include}}, etc.
Projects
None yet
Development

No branches or pull requests

2 participants