Skip to content

Commit 09384e3

Browse files
j-rewertsclayreimann
authored andcommitted
Fix browser markdown (#548)
Got the code from PR #505. Fixes #451.
1 parent ee64cd1 commit 09384e3

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

lib/Markdown.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Markdown extends Requestable {
3232
* @return {Promise} - the promise for the http request
3333
*/
3434
render(options, cb) {
35-
return this._request('POST', '/markdown', options, cb);
35+
return this._request('POST', '/markdown', options, cb, true);
3636
}
3737
}
3838

test/dist.spec/index.html

+19-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<script>mocha.setup('bdd')</script>
1313
<script>
1414
describe('the dist file', function() {
15-
it('should work', function(done) {
15+
it('should load a Gist', function(done) {
1616
var github = new GitHub();
1717
var gist = github.getGist('e265df71e7532f3a4bdd');
1818
gist.read()
@@ -21,6 +21,24 @@
2121
done();
2222
});
2323
});
24+
25+
it('should render markdown', function(done) {
26+
var shouldBe = '<p>Hello world github/linguist#1 <strong>cool</strong>, and #1!</p>\n';
27+
var github = new GitHub();
28+
var markdown = github.getMarkdown();
29+
const options = {
30+
text: 'Hello world github/linguist#1 **cool**, and #1!',
31+
};
32+
33+
markdown.render(options)
34+
.then(function({data: html}) {
35+
console.log(html);
36+
if (html !== shouldBe) {
37+
throw new Error(html + ' should be ' + shouldBe)
38+
}
39+
done();
40+
}).catch(done);
41+
});
2442
});
2543
</script>
2644
<script>

0 commit comments

Comments
 (0)