Skip to content

Commit

Permalink
Updated documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
oawhyte committed Jun 8, 2011
1 parent 2982f57 commit 5e31d55
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 16 deletions.
1 change: 1 addition & 0 deletions .yardopts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--markup markdown
14 changes: 14 additions & 0 deletions ext/markdown.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,22 @@ rb_multimarkdown_extract_metadata(VALUE self, VALUE key)
void Init_peg_multimarkdown()
{
rb_cMultiMarkdown = rb_define_class("PEGMultiMarkdown", rb_cObject);
/*
* Document-method: PEGMultiMarkdown#to_html
* Return string containing HTML generated from `text`
*/
rb_define_method(rb_cMultiMarkdown, "to_html", rb_multimarkdown_to_html, -1);
/*
* Document-method: PEGMultiMarkdown#to_latex
* Return string containing latex generated from `text`
*/
rb_define_method(rb_cMultiMarkdown, "to_latex", rb_multimarkdown_to_latex, -1);
/*
* Document-method: PEGMultiMarkdown#extract_metadata
* call-seq:
* extract_metadata(key)
* Extract metadata specified by `key` from `text`
*/
rb_define_method(rb_cMultiMarkdown, "extract_metadata", rb_multimarkdown_extract_metadata, 1);
}

Expand Down
32 changes: 16 additions & 16 deletions lib/peg_multimarkdown.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@
# Front-end to fletcher penney's peg-multimarkdown implementation of MultiMarkdown
#
# A simple processor:
# >>> puts MultiMarkdown.new("Hello, World.").to_html
# <p>Hello, World.</p>
# >> puts MultiMarkdown.new("Hello, World.").to_html
# <p>Hello, World.</p>
#
# With other stuff:
# >>> puts MultiMarkdown.new("_Hello -- World!_", :smart, :filter_html).to_html
# <p><em>Hello World!</em></p>
# >> puts MultiMarkdown.new("_Hello World!_", :smart, :filter_html).to_html
# <p><em>Hello World!</em></p>
#
class PEGMultiMarkdown

# Original MultiMarkdown formatted text.
attr_reader :text

# Set true to have smarty-like quote translation performed.
# Set `true` to have smarty-like quote translation performed.
attr_accessor :smart

# Set true to have footnotes processed.
# Set `true` to have footnotes processed.
attr_accessor :notes

# Do not output <style> tags included in the source text.
# Do not output `<style>` tags included in the source text.
attr_accessor :filter_styles

# Do not output any raw HTML included in the source text.
Expand All @@ -36,20 +36,20 @@ class PEGMultiMarkdown
# Included for compatibility with RedCloth's interface.
attr_accessor :fold_lines

# Create a new MultiMarkdown processor. The +text+ argument is a string
# Create a new MultiMarkdown processor. The `text` argument is a string
# containing MultiMarkdown text. Variable other arguments may be supplied to
# set various processing options:
#
# * <tt>:smart</tt> - Enable SmartyPants processing.
# * <tt>:notes</tt> - Enable footnotes.
# * <tt>:filter_styles</tt> - Do not output <style> tags included in the
# * `:smart` - Enable SmartyPants processing.
# * `:notes` - Enable footnotes.
# * `:filter_styles` - Do not output `<style>` tags included in the
# source text.
# * <tt>:filter_html</tt> - Do not output raw HTML included in the
# * `:filter_html` - Do not output raw HTML included in the
# source text.
# * <tt>:process_html</tt> - Process MultiMarkdown code inside HTML tags.
# * <tt>:compatibility</tt> - Process MultiMarkdown code in Markdown
# compatibility mode.
# * <tt>:fold_lines</tt> - RedCloth compatible line folding (not used).
# * `:process_html` - Process MultiMarkdown code inside HTML tags.
# * `:compatibility` - Process MultiMarkdown code in Markdown
# compatibility mode (disables all other extensions)
# * `:fold_lines` - RedCloth compatible line folding (not used).
#
def initialize(text, *extensions)
@text = text
Expand Down

0 comments on commit 5e31d55

Please sign in to comment.