Class: Markbridge::Renderers::Discourse::IdentityEscaper
- Inherits:
-
Object
- Object
- Markbridge::Renderers::Discourse::IdentityEscaper
- Defined in:
- lib/markbridge/renderers/discourse/identity_escaper.rb
Overview
Pass-through escaper. Returns its input unchanged.
Useful for migration paths where the source content is already valid Markdown (or otherwise trusted not to need escaping) and should reach the postprocessor verbatim. For partial passthrough (e.g. allow lists but still escape headings), see MarkdownEscaper#initialize‘s allow: kwarg.
Instance Method Summary collapse
-
#escape(text, in_link_label: false) ⇒ String
textwith]optionally escaped, or “” whentextis nil.
Instance Method Details
#escape(text, in_link_label: false) ⇒ String
Returns text with ] optionally escaped, or “” when text is nil.
28 29 30 31 32 33 |
# File 'lib/markbridge/renderers/discourse/identity_escaper.rb', line 28 def escape(text, in_link_label: false) return "" if text.nil? return text.gsub("]", "\\]") if in_link_label && text.include?("]") text end |