# Strikethrough

> Draw a line through text that readers can still see.

Strikethrough adds the `strike` mark. Use it to show a replaced price or a step the reader has completed.

## Try it

[Try the strike editor example](https://gpdoc.dev/docs/plugins/formatting/strike/#strike-example)

## Install

```sh
cargo add gpdoc-plugin-strike
```

## Example

Register the strikethrough formatter in the [Quickstart editor configuration](/docs/quickstart/#configure-the-editor). `strike()` uses this formatter by default.

```rust
use gpdoc::{EditorConfig, PluginViewExt};
use gpdoc_plugin_strike::{strike, strike_format};
use gpdoc_plugin_paragraph::paragraph;


let config = EditorConfig::builder()
    .plugin(paragraph())
    .plugin(strike().with_view(strike_format))
    .build()
    .expect("configure editor");
```

Type `~~old price~~` in a paragraph to draw a line through the words.

## Commands

These commands take no arguments. Select text to change its formatting, or place the caret where you want to start typing. `editor.run` returns `Result<CommandOutcome, Error>`. A handled command returns `Applied(AppliedChange)`. Set and toggle return `NotApplicable` if no text can take the mark.

### `setStrike`

Apply strikethrough to the selection or to the next characters typed at the caret.

```rust
editor.run(gpdoc_plugin_strike::Set)?;
```

### `toggleStrike`

Switch strikethrough off when the whole eligible selection has the mark. On a mixed selection, apply it throughout.

```rust
editor.run(gpdoc_plugin_strike::Toggle)?;
```

### `unsetStrike`

Clear strikethrough from the selection or turn it off for subsequent typing.

```rust
editor.run(gpdoc_plugin_strike::Unset)?;
```

## Keyboard shortcuts

Toggle strikethrough with **Command + Shift + S** on macOS or **Ctrl + Shift + S** on Windows and Linux.

Typing `~~old price~~` applies strikethrough.