Class: NRSER::MeanStreak

Inherits:
Object
  • Object
show all
Defined in:
lib/nrser/mean_streak.rb

Overview

Tag up terminals with color and style. Uses CommonMarker for the parsing (Markdown / CommonMark / GFM syntax).

MeanStreak instances hold configuration and provide functionality through instance methods, making it easy to use multiple configurations or subclass MeanStreak to further customize functionality.

An instance with default configuration is available via the MeanStreak.default class method, and additional class methods are provided that proxy to the default’s instance methods, providing convenient use of the default config.

Defined Under Namespace

Classes: Document

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.defaultNRSER::MeanStreak

Get the default instance, which has the default configuration and is used by the class methods.

Returns:



49
50
51
52
# File 'lib/nrser/mean_streak.rb', line 49

def self.default
  # TODO cache?
  new
end

.parse(text, options = :DEFAULT, extensions = []) ⇒ CommonMarker::Node

Public: Parses a Markdown string into a ‘document` node.

string - String to be parsed option - A Symbol or of Symbols indicating the parse options extensions - An of Symbols indicating the extensions to use

Returns:

  • (CommonMarker::Node)

    The ‘document` node.



64
65
66
# File 'lib/nrser/mean_streak.rb', line 64

def self.parse text, options = :DEFAULT, extensions = []
  
end

Instance Method Details

#parse(source, **options) ⇒ return_type

TODO:

Document parse method.

Returns @todo Document return value.

Parameters:

  • arg_name (type)

    @todo Add name param description.

Returns:

  • (return_type)

    @todo Document return value.



81
82
83
84
85
86
# File 'lib/nrser/mean_streak.rb', line 81

def parse source, **options
  NRSER::MeanStreak::Document.parse \
    source,
    **options,
    mean_streak: self
end