Skip to content

Numbered list with code block, should code block be 4 space deep? #6

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

Closed
jamesbraza opened this issue Jul 17, 2023 · 3 comments
Closed

Comments

@jamesbraza
Copy link

Similar issue to #4, now with code blocks in numbered lists:

  1. Item 1
    with a semantic line feed

    echo "I get moved around by prettier/mdformat, originally I am 3 spaces deep"
  2. Item 2

  3. Item 3

I have prettier (.prettierrc.toml: tabWidth = 4) and mdformat, together in pre-commit:

    - repo: https://github.com/pre-commit/mirrors-prettier
      rev: v3.0.0
      hooks:
          - id: prettier
    - repo: https://github.com/executablebooks/mdformat
      rev: 0.7.16
      hooks:
          - id: mdformat
            additional_dependencies:
                - mdformat-black
                - mdformat-footnote
                - mdformat-frontmatter
                - mdformat-gfm
                - mdformat-mkdocs>=1.0.2rc2
            args: [--align-semantic-breaks-in-numbered-lists]

Disclaimer: this may not be something mdformat-mkdocs solves.

I am wondering, should mdformat-mkdocs have been spacing the code block to 4-spaces?

Seems like (non-MkDocs) Markdown renderer is the same for both 3-spaces or 4-spaces.

KyleKing added a commit that referenced this issue Jul 17, 2023
Add tests based on #6 and #7
@KyleKing
Copy link
Owner

I'm assuming that prettier is making the change after verifying the mdformat behavior:

I added a test case to show that mdformat isn't changing the indent of the code block when the semantic indent flag is added (--align-semantic-breaks-in-numbered-lists) as shown in your configuration:

Code block in semantic indent (https://github.com/KyleKing/mdformat-mkdocs/issues/6)
.
1. Item 1
with a semantic line feed
```bash
echo "I get moved around by prettier/mdformat, originally I am 3 spaces deep"
```
1. Item 2
1. Item 3
.
1. Item 1
with a semantic line feed
```bash
echo "I get moved around by prettier/mdformat, originally I am 3 spaces deep"
```
1. Item 2
1. Item 3
.

and I have a test for running mdformat from pre-commit:

- id: mdformat-with-semantic-arg
name: mdformat-with-semantic-arg
entry: mdformat
args: [--align-semantic-breaks-in-numbered-lists]
files: tests/pre-commit-test-align_semantic_breaks_in_numbered_lists.md
types: [markdown]
language: system

@KyleKing
Copy link
Owner

I'm going to go ahead and close since there isn't anything I can do from here. Feel free to reopen if there is new information and/or open an issue with prettier

@KyleKing KyleKing closed this as not planned Won't fix, can't repro, duplicate, stale Jul 17, 2023
@jamesbraza
Copy link
Author

Thank you!

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

No branches or pull requests

2 participants