Class: Slideck::Converter Private

Inherits:
Object
  • Object
show all
Defined in:
lib/slideck/converter.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Responsible for converting Markdown into terminal output

Instance Method Summary collapse

Constructor Details

#initialize(markdown_parser, color: nil) ⇒ Converter

Create a Converter instance

Examples:

Slideck::Converter.new(TTY::Markdown, color: false)

Parameters:

  • markdown_parser (TTY::Markdown)

    the markdown parser

  • color (String, Symbol) (defaults to: nil)

    the color display out of always, auto or never



27
28
29
30
# File 'lib/slideck/converter.rb', line 27

def initialize(markdown_parser, color: nil)
  @markdown_parser = markdown_parser
  @color = validate_color(color)
end

Instance Method Details

#convert(content, symbols: nil, theme: nil, width: nil) ⇒ String

Convert content into terminal output

Examples:

converter.convert("#Title", width: 80)

Parameters:

  • content (String)

    the content to convert

  • symbols (Hash, String, Symbol) (defaults to: nil)

    the converted content symbols

  • theme (Hash{Symbol => Array, String, Symbol}) (defaults to: nil)

    the converted content theme

  • width (Integer) (defaults to: nil)

    the slide width

Returns:

  • (String)


49
50
51
52
# File 'lib/slideck/converter.rb', line 49

def convert(content, symbols: nil, theme: nil, width: nil)
  @markdown_parser.parse(
    content, color: @color, symbols: symbols, theme: theme, width: width)
end