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

Unintentional formatting of snippets #11

Open
breakid opened this issue Mar 15, 2024 · 0 comments · May be fixed by #12
Open

Unintentional formatting of snippets #11

breakid opened this issue Mar 15, 2024 · 0 comments · May be fixed by #12

Comments

@breakid
Copy link

breakid commented Mar 15, 2024

While working on some project documentation, I wanted to include a particularly detailed docstring from a Python script. The slicing functionality worked well; however, since the entire snippet was indented in the original file, Markdown treated it as a code block and syntax highlight was automatically applied to it.

It would be nice to have the option to strip the smallest amount of white space on any line from every line. For instance:

    # This line is indented 4 spaces
    def function_name(self, arg1):
        # This line is indented 8 spaces
        print(arg1)

Would be normalized to:

# This line is indented 0 spaces
def function_name(self, arg1):
    # This line is indented 4 spaces
    print(arg1)

The function definition line had the least number of spaces (4), so four spaces were removed from all of the lines.

To match your existing formatting syntax, I recommend: {!< file_path_or_url!}

You could even use both (e.g., {!<> file_path_or_url!}) to unindent the included content then indent to match the destination.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant