Skip to content

markdown-preferences/strikethrough-delimiters-style

enforce a consistent delimiter style for strikethrough

  • ⚙️ This rule is included in plugin.configs.standard.
  • 🔧 The --fix option on the command line can automatically fix some of the problems reported by this rule.

📖 Rule Details

This rule enforces a consistent delimiter style for strikethrough in Markdown documents.

Note: Strikethrough is not part of the CommonMark specification, but is supported as an extension in GitHub Flavored Markdown (GFM).

In GFM, only the tilde (~) character is valid for strikethrough. Both single and double tildes (~text~ and ~~text~~) are allowed, and which to use is determined by this rule's option.

This rule reports and can automatically fix the use of a tilde delimiter count that does not match the configured option. Other symbols are not supported.

Examples

~~ Style (Default)

md
<!-- eslint markdown-preferences/strikethrough-delimiters-style: 'error' -->

<!-- ✓ GOOD (when option: { "delimiter": "~~" }) -->
~~strikethrough~~

<!-- ✗ BAD (when option: { "delimiter": "~~" }) -->
~strikethrough~

~ Style (Default)

md
<!-- eslint markdown-preferences/strikethrough-delimiters-style: ['error', { "delimiter": "~" }] -->

<!-- ✓ GOOD (when option: { "delimiter": "~" }) -->
~strikethrough~

<!-- ✗ BAD (when option: { "delimiter": "~" }) -->
~~strikethrough~~

🔧 Options

json
{
  "markdown-preferences/strikethrough-delimiters-style": [
    "error",
    { "delimiter": "~~" }
  ]
}

This rule has one option:

  • delimiter: Specify the delimiter to use for strikethrough. Accepts "~~" (default) or "~".
    • "~~": Only double tilde (~~text~~) is allowed (default, CommonMark/GFM standard)
    • "~": Allow single tilde (~text~) as strikethrough (for non-standard/extended Markdown)

📚 Further Reading

🚀 Version

This rule was introduced in eslint-plugin-markdown-preferences v0.19.0

🔍 Implementation