Skip to content

Commit

Permalink
Fix browser markdown (#548)
Browse files Browse the repository at this point in the history
Got the code from PR #505.
Fixes #451.
  • Loading branch information
j-rewerts authored and clayreimann committed Apr 17, 2019
1 parent ee64cd1 commit 09384e3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/Markdown.js
Expand Up @@ -32,7 +32,7 @@ class Markdown extends Requestable {
* @return {Promise} - the promise for the http request
*/
render(options, cb) {
return this._request('POST', '/markdown', options, cb);
return this._request('POST', '/markdown', options, cb, true);
}
}

Expand Down
20 changes: 19 additions & 1 deletion test/dist.spec/index.html
Expand Up @@ -12,7 +12,7 @@
<script>mocha.setup('bdd')</script>
<script>
describe('the dist file', function() {
it('should work', function(done) {
it('should load a Gist', function(done) {
var github = new GitHub();
var gist = github.getGist('e265df71e7532f3a4bdd');
gist.read()
Expand All @@ -21,6 +21,24 @@
done();
});
});

it('should render markdown', function(done) {
var shouldBe = '<p>Hello world github/linguist#1 <strong>cool</strong>, and #1!</p>\n';
var github = new GitHub();
var markdown = github.getMarkdown();
const options = {
text: 'Hello world github/linguist#1 **cool**, and #1!',
};

markdown.render(options)
.then(function({data: html}) {
console.log(html);
if (html !== shouldBe) {
throw new Error(html + ' should be ' + shouldBe)
}
done();
}).catch(done);
});
});
</script>
<script>
Expand Down

0 comments on commit 09384e3

Please sign in to comment.