Class: Banzai::Filter::MathFilter
- Inherits:
-
HTML::Pipeline::Filter
- Object
- HTML::Pipeline::Filter
- Banzai::Filter::MathFilter
- Defined in:
- lib/banzai/filter/math_filter.rb
Overview
HTML filter that implements the original GitLab math syntax, one of three filters: DollarMathPreFilter, DollarMathPostFilter, and MathFilter
Constant Summary collapse
- CSS_MATH =
Handle the $‘…`$ and “`math syntax in this filter. Also add necessary classes any existing math blocks.
'pre[data-canonical-lang="math"] > code'
- XPATH_MATH =
Gitlab::Utils::Nokogiri.css_to_xpath(CSS_MATH).freeze
- CSS_CODE =
'code'
- XPATH_CODE =
Gitlab::Utils::Nokogiri.css_to_xpath(CSS_CODE).freeze
- CSS_INLINE_CODE =
'code[data-math-style]'
- XPATH_INLINE_CODE =
Gitlab::Utils::Nokogiri.css_to_xpath(CSS_INLINE_CODE).freeze
- STYLE_ATTRIBUTE =
Attribute indicating inline or display math.
'data-math-style'
- TAG_CLASS =
Class used for tagging elements that should be rendered
'js-render-math'
- MATH_CLASSES =
"code math #{TAG_CLASS}"
- DOLLAR_SIGN =
'$'
- RENDER_NODES_LIMIT =
Limit to how many nodes can be marked as math elements. Prevents timeouts for large notes. For more information check: gitlab.com/gitlab-org/gitlab/-/issues/341832
50
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/banzai/filter/math_filter.rb', line 35 def call @nodes_count = 0 process_existing process_dollar_backtick_inline process_math_codeblock doc end |