Remove Blank Line in YAML Frontmatter

If you have blank lines in your YAML frontmatter such as below…

---
title: My Title

slug: /slug/
---

In Notepad++ —

  1. Replace Tab
    i). Ctrl+H
    ii). Find what: ---(?:(?!---).)+?\K(\R){2,}(?=.*?---)
    iii). Replace with: $1
    iv). CHECK Wrap around
    v). CHECK Regular expression
    vi). CHECK . matches newline
    vii). Replace all

or

  1. Find in files
    i). Ctrl+H
    ii). Find what: ---(?:(?!---).)+?\K(\R){2,}(?=.*?---)
    iii). Replace with: $1
    iv). Directory (input or navigate to where the files are)
    v). CHECK Regular expression
    vi). CHECK . matches newline
    vii). Replace all

You might need to repeat either process if there are more blank gaps.

1 Like