Last active
December 23, 2015 00:18
-
-
Save ntrepid8/6552247 to your computer and use it in GitHub Desktop.
A function to pull markdown documents down (from Dropbox in my case) and convert them to HTML and return the HTML text. It requires the excellent markdown.converter.js (https://code.google.com/p/pagedown/) library.
This file contains 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
/** | |
* Created with PyCharm. | |
* User: ntrepid8 | |
* Date: 9/9/13 | |
* Time: 4:55 PM | |
*/ | |
// Markdown Converter get it at https://code.google.com/p/pagedown/ | |
var converter = new Markdown.Converter(); | |
var md2html = (function(){ | |
var m = {}; | |
m.get = function(url, success, error){ | |
$.ajax({ | |
url: url, | |
type: 'GET', | |
success: function(data){ | |
if (success){ | |
success(converter.makeHtml(data)) | |
} | |
}, | |
error: function(jqxhr, textStatus, error){ | |
if (error){error(jqxhr, textStatus, error)} | |
} | |
}) | |
}; | |
return m | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment