Last active
April 26, 2016 08:39
-
-
Save zlargon/1d598f471e1ebcf6d2779f64d0c10921 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Github Flavored Markdown</title> | |
<link rel="stylesheet" type="text/css" href="https://cdn.rawgit.com/sindresorhus/github-markdown-css/gh-pages/github-markdown.css"> | |
<style> | |
.markdown-body { | |
width: 980px; | |
margin: 20px auto; | |
padding: 45px; | |
border: 1px solid lightgray; | |
border-radius: 3px; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="root" class="markdown-body"></div> | |
<script type="text/javascript"> | |
fetch('https://api.github.com/markdown', { | |
method: 'POST', | |
headers: { | |
'Content-Type': 'application/json' | |
}, | |
body: JSON.stringify({ | |
"text": "# Hello world\n\ngithub/linguist#1 **cool**, and #1!", | |
"mode": "gfm", | |
"context": "github/gollum" | |
}) | |
}) | |
.then(res => { | |
if (res.status !== 200) { | |
throw new Error(`request failed, status code = ${res.status} (${res.statusText})`); | |
} | |
return res.text(); | |
}) | |
.then(html => { | |
document.getElementById('root').innerHTML = html; | |
}) | |
.catch(console.error); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment