Module: Octokit::Client::Markdown

Included in:
Octokit::Client
Defined in:
lib/octokit/client/markdown.rb

Overview

Methods for the Markdown API

Instance Method Summary collapse

Instance Method Details

#markdown(text, options = {}) ⇒ String

Render an arbitrary Markdown document

Examples:

Render some GFM

Octokit.markdown('Fixed in #111', :mode => "gfm", :context => "octokit/octokit.rb")

Parameters:

  • text (String)

    Markdown source

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

    a customizable set of options

Options Hash (options):

  • (optional) (String)

    :mode (‘markdown` or `gfm`)

  • (optional) (String)

    :context Repo context

Returns:

  • (String)

    HTML renderization

See Also:



18
19
20
21
22
23
24
# File 'lib/octokit/client/markdown.rb', line 18

def markdown(text, options = {})
  options[:text] = text
  options[:repo] = Repository.new(options[:repo]) if options[:repo]
  options[:accept] = 'application/vnd.github.raw'

  post "markdown", options
end