markdownlint-cli2 icon indicating copy to clipboard operation
markdownlint-cli2 copied to clipboard

Codeblocks in list bodies

Open lbirkert opened this issue 1 year ago • 2 comments

Hey there,

trying to use codeblocks in list bodies:

1. Install the latest version of rust: <https://rustup.rs/>
2. Clone the repository:

  \```sh
    git clone --depth 1 https://github.com/qb-rs/qb
    cd qb
  \```

3. Start the daemon process:

  \```sh
    cargo run --bin qb-daemon
  \```

4. Start the GUI Application:

  \```txt
    cargo run --bin qb-app
  \```

This however produces these lint errors:

README.md:74:1 MD029/ol-prefix Ordered list item prefix [Expected: 1; Actual: 3; Style: 1/1/1]
README.md:80:1 MD029/ol-prefix Ordered list item prefix [Expected: 1; Actual: 4; Style: 1/1/1]

It seems that the codeblock is not actually recognized as a body. Is this expected or a bug? Should I just disable the rule for this section?

(\` used to escape, because github's rendering, actual example does not include \`)

lbirkert avatar Aug 20 '24 14:08 lbirkert

It looks like you have not indented the fence far enough. Because it is nested inside and ordered list item that begins three characters from the left, the fence should also begin three characters from the left. Your example has it only two.

Here is a corrected version of your example: https://dlaa.me/markdownlint/#%25m%23%20Issue%20397%0A%0A1.%20Install%20the%20latest%20version%20of%20rust%3A%20%3Chttps%3A%2F%2Frustup.rs%2F%3E%0A2.%20Clone%20the%20repository%3A%0A%0A%20%20%20%60%60%60sh%0A%20%20%20%20git%20clone%20--depth%201%20https%3A%2F%2Fgithub.com%2Fqb-rs%2Fqb%0A%20%20%20%20cd%20qb%0A%20%20%20%60%60%60%0A%0A3.%20Start%20the%20daemon%20process%3A%0A

DavidAnson avatar Aug 20 '24 16:08 DavidAnson

(Because of the insufficient indentation, the fenced code blocks were treated as being at the top level and split the list into lists, each of which was expected to begin at one.)

DavidAnson avatar Aug 20 '24 16:08 DavidAnson