Module: Markdown

Defined in:
lib/markdown.rb,
lib/markdown/gen.rb,
lib/markdown/config.rb,
lib/markdown/wrapper.rb,
lib/markdown/engines/maruku.rb,
lib/markdown/engines/kramdown.rb,
lib/markdown/engines/bluecloth.rb,
lib/markdown/engines/rdiscount.rb,
lib/markdown/engines/redcarpet.rb,
lib/markdown/engines/pandoc_ruby.rb,
lib/markdown/engines/rpeg_markdown.rb

Defined Under Namespace

Modules: Engine Classes: Config, Gen, Opts, Wrapper

Constant Summary collapse

VERSION =
'0.4.0'
@@config =
nil

Class Method Summary collapse

Class Method Details

version string for generator meta tag (includes ruby version)



48
49
50
# File 'lib/markdown.rb', line 48

def self.banner
  "Markdown #{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
end

.extnamesObject



37
38
39
40
41
42
# File 'lib/markdown/wrapper.rb', line 37

def self.extnames
  if @@config.nil?
    @@config = Config.new
  end
  @@config.markdown_extnames
end

.filtersObject



44
45
46
47
48
49
# File 'lib/markdown/wrapper.rb', line 44

def self.filters
  if @@config.nil?
    @@config = Config.new
  end
  @@config.markdown_filters
end

.libObject



30
31
32
33
34
35
# File 'lib/markdown/wrapper.rb', line 30

def self.lib
  if @@config.nil?
    @@config = Config.new
  end
  @@config.markdown_lib
end

.lib=(value) ⇒ Object



26
27
28
# File 'lib/markdown/wrapper.rb', line 26

def self.lib=( value )
    ## todo: lets you select your library    
end

.mainObject



52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/markdown.rb', line 52

def self.main
  
  # allow env variable to set RUBYOPT-style default command line options
  #   e.g. -o site 
  markdownopt = ENV[ 'MARKDOWNOPT' ]
  
  args = []
  args += markdownopt.split if markdownopt
  args += ARGV.dup
  
  Gen.new.run(args)
end

.new(content, options = {}) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/markdown/wrapper.rb', line 52

def self.new( content, options={} )

  ## todo: allow options to pass in
  ##   lets you change markdown engine/converter for every call
  ##   e.g. lets you add config properties (as headers) to your document (for example)
  
  if @@config.nil?
    @@config = Config.new
  end

  lib      = @@config.markdown_lib
  mn       = @@config.markdown_to_html_method # lets you use differnt options/converters for a single markdown lib   
  defaults = @@config.markdown_lib_defaults  ## todo/fix: use mn / converter from defaults hash?? mn no longer needed??    

  props = Props.new( options, 'USER', Props.new( defaults, 'SYSTEM' ))
  
  Wrapper.new( lib, mn, content, props )
end