Module: GitlabKramdown::Parser::Escape

Included in:
Kramdown::Parser::GitlabKramdown
Defined in:
lib/gitlab_kramdown/parser/escape.rb

Overview

Escape chars support

This is a standalone parser because making it so is an optimization

Based on Kramdown GFM implementation

Constant Summary collapse

ESCAPED_CHARS_GFM =
/\\([\\.*_+`<>()\[\]{}#!:|"'$=\-~])/

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



13
14
15
16
17
# File 'lib/gitlab_kramdown/parser/escape.rb', line 13

def self.included(klass)
  return if klass.has_parser?(:escape_chars_gitlab)

  klass.define_parser(:escape_chars_gitlab, ESCAPED_CHARS_GFM, '\\\\', :parse_escaped_chars)
end