mdsmith
Esc
    v0.52.0 GitHub
    MDS065 code ready

    MDS065: code-block-style

    Code blocks must use a single delimiter — fenced or four-space indented — consistently across the file.

    # Settings

    SettingTypeDefaultDescription
    stylestring"fenced""consistent" (first block sets the convention), "fenced" (```), or "indented" (four-space).

    # Autofix

    mdsmith fix converts each indented code block to a fenced block when the resolved style is fenced. The converted block gets the language tag text so the result satisfies fenced-code-language (MDS011); edit it to the real language after fixing.

    The new fence is sized to clear any backtick run at the start of a content line, so the embedded run never closes the converted block prematurely. A block with a ``` line is wrapped in a 4-backtick fence; a block with ```` gets a 5-backtick fence; and so on.

    The reverse direction (fenced → indented) is not auto-applied: it would drop any language tag set on the fenced block.

    # Config

    Enable (default — fenced style):

    rules:
      code-block-style:
        style: fenced

    Disable:

    rules:
      code-block-style: false

    Require four-space indented blocks:

    rules:
      code-block-style:
        style: indented

    Pin the style to whichever the first block uses:

    rules:
      code-block-style:
        style: consistent

    # Examples

    # Good — default style

    # Title
    
    ```go
    fmt.Println("hello")
    ```

    # Good — style: indented

    # Title
    
    Some text first.
    
        indented code

    # Bad — default style

    # Title
    
    Some text first.
    
        indented code

    # Meta-Information

    • ID: MDS065
    • Name: code-block-style
    • Status: ready
    • Default: enabled, style: fenced
    • Fixable: indented → fenced only
    • Implementation: source
    • Category: code
    • markdownlint: MD046 (code-block-style)
    • rumdl: MD046 (code-block-style)
    • mado: MD046 (code-block-style)