Class: Amp::Help::MarkdownHelpEntry

Inherits:
HelpEntry show all
Defined in:
lib/amp-front/help/help.rb

Overview

Represents a help entry that filters its help text through a Markdown parser before returning.

This makes it very easy to make very pretty help files, that are smart enough to look good in both HTML form and when printed to a terminal. This uses our additions to the markdown parser to provide an “ANSI” output format.

Instance Method Summary collapse

Methods inherited from HelpEntry

#desc, from_file, #initialize

Constructor Details

This class inherits a constructor from Amp::Help::HelpEntry

Instance Method Details

#text(options = {}) ⇒ String

Returns the help text to display for this entry.

For a markdown entry, we run this through Maruku and our special to_ansi output formatter. This will make things like this underlined and these bolded. Code blocks will be given a colored background, and headings are accentuated.

Parameters:

  • options (Hash) (defaults to: {})

    the options for the process - that way the help commands can access the user’s run-time options and global configuration. For example, if the user passes in –verbose or –quiet, each help entry could handle that differently. Who are we to judge?

Returns:

  • (String)

    the help text for the entry.



173
174
175
# File 'lib/amp-front/help/help.rb', line 173

def text(options = {})
  Maruku.new(super, {}).to_ansi
end