Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/banzai/filter/normalize_source_filter.rb')
-rw-r--r--lib/banzai/filter/normalize_source_filter.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/banzai/filter/normalize_source_filter.rb b/lib/banzai/filter/normalize_source_filter.rb
new file mode 100644
index 00000000000..975cd540873
--- /dev/null
+++ b/lib/banzai/filter/normalize_source_filter.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+module Banzai
+ module Filter
+ class NormalizeSourceFilter < HTML::Pipeline::Filter
+ UTF8_BOM = "\xEF\xBB\xBF"
+
+ def call
+ # Remove UTF8_BOM from beginning of source text
+ html.delete_prefix(UTF8_BOM)
+ end
+ end
+ end
+end