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?|\n/
NULL_RE =
/\0/

Class Method Summary collapse

Class Method Details

.normalize(state) ⇒ Object




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

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

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

  state.src = str
end