# 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.

{/* Generated by src/codegen/lint-rule-docs.ts. Do not edit this section. */}

## Configure

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

{/* skip */}

```js 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`.

{/* End of the generated section. */}

## Examples

Reported:

{/* bad {"count": 3} */}

```md
This is ** important**.

This is _important _.

This is *** very important***.
```

Not reported:

{/* good */}

```md
This is **important** and _this_ too.

2 * 3 is 6.
```

## Options

| Option               | Default | What it does                           |
| -------------------- | ------- | -------------------------------------- |
| `checkStrikethrough` | `false` | Also check `~` and `~~`.               |

{/* bad {"language": "gfm", "options": [{ "checkStrikethrough": true }]} */}

```md
This is ~~ gone~~.
```

{/* good {"language": "gfm", "options": [{ "checkStrikethrough": true }]} */}

```md
This is ~~gone~~.
```
