# frozen_string_literal: true
# Generated HTML is transformed back to GFM by:
# - app/assets/javascripts/behaviors/markdown/marks/math.js
# - app/assets/javascripts/behaviors/markdown/nodes/code_block.js
module Banzai
module Filter
# HTML filter that implements our dollar math syntax, one of three filters:
# DollarMathPreFilter, DollarMathPostFilter, and MathFilter
#
class DollarMathPostFilter < HTML::Pipeline::Filter
# Based on the Pandoc heuristics,
# https://pandoc.org/MANUAL.html#extension-tex_math_dollars
#
# Handle the $...$ and $$...$$ inline syntax in this filter, after markdown processing
# but before post-handling of escaped characters. Any escaped $ will have been specially
# encoded and will therefore not interfere with the detection of the dollar syntax.
# Corresponds to the "$...$" syntax
DOLLAR_INLINE_UNTRUSTED =
'(?P\$(?P