GitHubMarkdownAPI
GitHub's Markdown Rendering API client and command-line tool.
Installation
Add this line to your application's Gemfile:
gem 'github_markdown_api'
And then execute:
$ bundle
Or install it yourself as:
$ gem install github_markdown_api
Usage
Raw API
In ruby script:
require 'github_markdown_api'
md = <<EOM
AWESOME SCRIPT
==============
It's a wonderful markup language!
* Markdown
* reStructuredText
EOM
github_md = GitHubMarkdownAPI::Client.new
html = github_md.raw(md)
puts html
#=>
# <h1>
# <a name="awesome-script" class="anchor" href="#awesome-script"><span class="octicon octicon-link"></span></a>AWESOME SCRIPT</h1>
#
# <p>It's a wonderful markup language!</p>
#
# <ul>
# <li>Markdown</li>
# <li>reStructuredText</li>
# </ul>
In command-line:
% cat ./awesome.md
AWESOME SCRIPT
==============
It's a wonderful markup language!
* Markdown
* reStructuredText
% github_markdown_api ./awesome.md > ./awesome.html
% cat ./awesome.html
<h1>
<a name="awesome-script" class="anchor" href="#awesome-script"><span class="octicon octicon-link"></span></a>AWESOME SCRIPT</h1>
<p>It's a wonderful markup language!</p>
<ul>
<li>Markdown</li>
<li>reStructuredText</li>
</ul>
Attr API
Advansed
my_md_api = GitHubMarkdownAPI::Client.new(
scheme: 'http',
host: 'your.markdown.serv',
port: 3939,
endpoints: {raw: '/md/raw'},
)
puts my_md_api(markdown)
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request