Class: Upmark::Transform::Markdown

Inherits:
Parslet::Transform
  • Object
show all
Includes:
Upmark::TransformHelpers
Defined in:
lib/upmark/transform/markdown.rb

Overview

A transform class which converts an abstract syntax tree (AST) into a Markdown document.

Class Method Summary collapse

Methods included from Upmark::TransformHelpers

included

Class Method Details

.text(element) ⇒ Object



37
38
39
# File 'lib/upmark/transform/markdown.rb', line 37

def self.text(element)
  element[:children].join.gsub(/(\n)[\n ]+/, '\1')
end