---
title: Fix Obsidian List Spacing After Pasting from AI or HTML
description: A quick Obsidian workflow to clean extra list spacing after AI or HTML paste using Linter custom regex and a keyboard shortcut.
publishDate: 2026-02-14
canonical: https://www.mandalivia.com/obsidian/fix-obsidian-list-spacing-after-ai-paste/
---

## The issue

When I paste content from AI output or HTML into Obsidian, some lines show up with leading spaces (often 4 spaces), which creates awkward spacing and messy lists.

![Obsidian note showing pasted list content with unwanted spacing caused by leading spaces](../../assets/wonderings/fix-obsidian-list-spacing-after-ai-paste/fix-obsidian-list-spacing-after-ai-paste-2026-02-14.webp)

This makes quick capture painful because I have to manually clean formatting before I can keep writing.

## The fix

I used the **Linter** plugin with a **Custom Regex** rule.

- Regex: `^ {4}\n`
- Replace: nothing

This removes lines that contain exactly four spaces.

![Obsidian Linter custom regex configuration removing four-space blank lines after paste](../../assets/wonderings/fix-obsidian-list-spacing-after-ai-paste/fix-obsidian-list-spacing-after-ai-paste-2026-02-14-1.webp)

## Workflow I use

1. Paste content with `Cmd + V`
2. Run Linter with `Opt + Cmd + L`

## What I learned

Custom regex rules are useful for cleanup cases that built-in linter options do not handle directly.

Also, the regex cleanup does not run by itself. It runs only when the Linter command is triggered, so having a keyboard shortcut is the key quality-of-life improvement.

## Related notes

- [obsidian-with-astro-cms](/obsidian/obsidian-with-astro-for-personal-site/)
- [obsidian-habit-tracker](/obsidian/habit-tracker-for-obsidian-daily-notes/)