diff --git a/REFERENCE.md b/REFERENCE.md
index 2ce3ac4..84a4c70 100644
--- a/REFERENCE.md
+++ b/REFERENCE.md
@@ -9,6 +9,7 @@
* [`extlib::cache_data`](#extlib--cache_data): Retrieves data from a cache file, or creates it with supplied data if the file doesn't exist
* [`extlib::cidr_to_netmask`](#extlib--cidr_to_netmask): Converts an CIDR address of the form 192.168.0.1/24 into its netmask.
* [`extlib::cidr_to_network`](#extlib--cidr_to_network): Converts a CIDR address of the form 2001:DB8::/32 or 192.0.2.0/24 into their network address (also known as net address)
+* [`extlib::clean_blank_lines`](#extlib--clean_blank_lines): Remove blank lines from a string
* [`extlib::compare_ip`](#extlib--compare_ip): A function that compares two IP addresses. To be used with the built-in sort() function.
* [`extlib::default_content`](#extlib--default_content): Takes an optional content and an optional template name and returns the contents of a file.
* [`extlib::dir_clean`](#extlib--dir_clean): Take a path and normalise it to its Unix form.
@@ -175,6 +176,24 @@ Data type: `Variant[Stdlib::IP::Address::V4::CIDR,Stdlib::IP::Address::V6::CIDR]
IPv6 or IPv4 address in CIDR notation
+### `extlib::clean_blank_lines`
+
+Type: Puppet Language
+
+Remove blank lines from a string
+
+#### `extlib::clean_blank_lines(String[1] $content)`
+
+The extlib::clean_blank_lines function.
+
+Returns: `String[1]` The content with blank lines removed
+
+##### `content`
+
+Data type: `String[1]`
+
+The content to remove blank lines from
+
### `extlib::compare_ip`
Type: Ruby 4.x API
diff --git a/functions/remove_blank_lines.pp b/functions/remove_blank_lines.pp
new file mode 100644
index 0000000..754d59e
--- /dev/null
+++ b/functions/remove_blank_lines.pp
@@ -0,0 +1,8 @@
+# @summary Remove blank lines from a string
+# @param content The content to remove blank lines from
+# @return The content with blank lines removed
+function extlib::clean_blank_lines (
+ String[1] $content,
+) >> String[1] {
+ return $content.split("\n").filter |$x| { !$x.empty }.join("\n")
+}
diff --git a/spec/functions/remove_blank_lines_spec.rb b/spec/functions/remove_blank_lines_spec.rb
new file mode 100644
index 0000000..03c1e38
--- /dev/null
+++ b/spec/functions/remove_blank_lines_spec.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+input = <<-TEXT
+ string_name: "string_value"
+
+ int_name: 42
+
+ true_name: yes
+TEXT
+output = <<-TEXT
+ string_name: "string_value"
+ int_name: 42
+ true_name: yes
+TEXT
+
+describe 'extlib::remove_blank_lines' do
+ it { is_expected.to run.with_params(input).and_return(output) }
+end