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/front_matter_filter.rb')
-rw-r--r--lib/banzai/filter/front_matter_filter.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/banzai/filter/front_matter_filter.rb b/lib/banzai/filter/front_matter_filter.rb
index 705400a5497..c788137e122 100644
--- a/lib/banzai/filter/front_matter_filter.rb
+++ b/lib/banzai/filter/front_matter_filter.rb
@@ -9,7 +9,10 @@ module Banzai
html.sub(Gitlab::FrontMatter::PATTERN) do |_match|
lang = $~[:lang].presence || lang_mapping[$~[:delim]]
- ["```#{lang}:frontmatter", $~[:front_matter].strip!, "```", "\n"].join("\n")
+ before = $~[:before]
+ before = "\n#{before}" if $~[:encoding].presence
+
+ "#{before}```#{lang}:frontmatter\n#{$~[:front_matter]}```\n"
end
end
end