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:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-05-17 19:05:49 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-05-17 19:05:49 +0300
commit43a25d93ebdabea52f99b05e15b06250cd8f07d7 (patch)
treedceebdc68925362117480a5d672bcff122fb625b /lib/banzai/filter/markdown_engines/common_mark.rb
parent20c84b99005abd1c82101dfeff264ac50d2df211 (diff)
Add latest changes from gitlab-org/gitlab@16-0-stable-eev16.0.0-rc42
Diffstat (limited to 'lib/banzai/filter/markdown_engines/common_mark.rb')
-rw-r--r--lib/banzai/filter/markdown_engines/common_mark.rb18
1 files changed, 3 insertions, 15 deletions
diff --git a/lib/banzai/filter/markdown_engines/common_mark.rb b/lib/banzai/filter/markdown_engines/common_mark.rb
index 7abfadc612b..63680aa102c 100644
--- a/lib/banzai/filter/markdown_engines/common_mark.rb
+++ b/lib/banzai/filter/markdown_engines/common_mark.rb
@@ -9,7 +9,7 @@
module Banzai
module Filter
module MarkdownEngines
- class CommonMark
+ class CommonMark < Base
EXTENSIONS = [
:autolink, # provides support for automatically converting URLs to anchor tags.
:strikethrough, # provides support for strikethroughs.
@@ -29,9 +29,7 @@ module Banzai
:UNSAFE # allow raw/custom HTML and unsafe links.
].freeze
- def initialize(context)
- @context = context
- end
+ RENDER_OPTIONS_SOURCEPOS = RENDER_OPTIONS + [:SOURCEPOS].freeze
def render(text)
CommonMarker.render_html(text, render_options, EXTENSIONS)
@@ -40,17 +38,7 @@ module Banzai
private
def render_options
- @context[:no_sourcepos] ? render_options_no_sourcepos : render_options_sourcepos
- end
-
- def render_options_no_sourcepos
- RENDER_OPTIONS
- end
-
- def render_options_sourcepos
- render_options_no_sourcepos + [
- :SOURCEPOS # enable embedding of source position information
- ].freeze
+ sourcepos_disabled? ? RENDER_OPTIONS : RENDER_OPTIONS_SOURCEPOS
end
end
end