Class: MarkdownIt::RulesCore::Normalize

Inherits:
Object
  • Object
show all
Defined in:
lib/motion-markdown-it/rules_core/normalize.rb

Constant Summary collapse

NEWLINES_RE =
/\r[\n\u0085]?|[\u2424\u2028\u0085]/
NULL_RE =
/\u0000/

Class Method Summary collapse

Class Method Details

.inline(state) ⇒ Object




11
12
13
14
15
16
17
18
19
# File 'lib/motion-markdown-it/rules_core/normalize.rb', line 11

def self.inline(state)
  # Normalize newlines
  str = state.src.gsub(NEWLINES_RE, "\n")

  # Replace NULL characters
  str = str.gsub(NULL_RE, '\uFFFD')

  state.src = str
end