Skip to content

Instantly share code, notes, and snippets.

@KrzaQ
Created February 19, 2017 20:01
Show Gist options
  • Select an option

  • Save KrzaQ/008f8d5d1f95c29ae3eb1c48d2610b13 to your computer and use it in GitHub Desktop.

Select an option

Save KrzaQ/008f8d5d1f95c29ae3eb1c48d2610b13 to your computer and use it in GitHub Desktop.
<h1 id="test"> test</h1>
<h2 id="bleh"> bleh</h2>
<pre class="prettyprint"><code>foo
foo bar baz
class huj {};
</code></pre>
<p>inline code: <code class="prettyprint">inline code</code>
</p>
[Finished in 0.3s]
#!/usr/bin/ruby
require 'httpclient'
require 'json'
def from_md(x)
opts = {
'Content-Type' => 'application/json'
}
ret = HTTPClient.new.post('http://archvm:8080/api/parse_markdown', { md: x }.to_json , opts).body
JSON.parse(ret)['markdown']
end
str = <<MD
# test
## bleh
```
foo
foo bar baz
class huj {};
```
inline code: `inline code`
MD
puts from_md str
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment