JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 113623
  • Score
    100M100P100Q170991F
  • License MIT

remark-lint rule to warn when code-blocks do not adhere to a given style

Package Exports

  • remark-lint-code-block-style

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (remark-lint-code-block-style) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

remark-lint-code-block-style

Warn when code-blocks do not adhere to a given style.

Options: string, either 'consistent', 'fenced', or 'indented', default: 'consistent'.

The default value, consistent, detects the first used code-block style, and will warn when a subsequent code-block uses a different style.

Install

npm install --save remark-lint-code-block-style

Example

When this rule is 'indented', the following file valid.md is ok:

<!-- This is also valid when `'consistent'` -->

    alpha();

Paragraph.

    bravo();

When this rule is 'indented', the following file invalid.md is not ok:

        ```
        alpha();
        ```

        Paragraph.

        ```
        bravo();
        ```
1:1-3:4: Code blocks should be indented
7:1-9:4: Code blocks should be indented

When this rule is 'fenced', the following file valid.md is ok:

        <!-- This is also valid when `'consistent'` -->

        ```
        alpha();
        ```

        Paragraph.

        ```
        bravo();
        ```

When this rule is 'fenced', the following file invalid.md is not ok:

    alpha();

Paragraph.

    bravo();
1:1-1:13: Code blocks should be fenced
5:1-5:13: Code blocks should be fenced

When this rule is turned on, the following file invalid.md is not ok:

        <!-- This is always invalid -->

            alpha();

        Paragraph.

        ```
        bravo();
        ```
7:1-9:4: Code blocks should be indented

When 'invalid' is passed in, the following error is given:

1:1: Invalid code block style `invalid`: use either `'consistent'`, `'fenced'`, or `'indented'`

License

MIT © Titus Wormer