Skip to content
NewBun 1.4.5 is out. Release notes
AphrodyBun

Linter · Rules

markdown/no-space-in-emphasis

Disallow spaces around emphasis markers

** bold ** is not bold. A * or _ only starts emphasis if no space follows it, and only ends emphasis if no space comes before it. Otherwise the markers show up in the text.

--fix removes the space.

Configure

Off by default. It needs an ESLint config that says which files are in the language:

eslint.config.js
import markdown from "@eslint/markdown";

export default [
  {
    files: ["**/*.md"],
    plugins: { markdown },
    language: "markdown/commonmark",
    rules: { "markdown/no-space-in-emphasis": "error" },
  },
];

It also works with markdown/gfm.

Examples

Reported:

This is ** important**.

This is _important _.

This is *** very important***.

Not reported:

This is **important** and _this_ too.

2 * 3 is 6.

Options

OptionDefaultWhat it does
checkStrikethroughfalseAlso check ~ and ~~.
This is ~~ gone~~.
This is ~~gone~~.