Created
October 19, 2022 18:11
-
-
Save robkooper/27235ca1c26b766cb56a4f55c376b5c8 to your computer and use it in GitHub Desktop.
markdown renderer for clowder, place the files in a folder .../custom/public/javascripts/previewers/markdown
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
(function($, Configuration) { | |
// Preserve these in our current scope | |
var initialTab = Configuration.tab; | |
var initialID = Configuration.id; | |
var initialPreviewer = Configuration.previewer; | |
// add div for markdown | |
$(initialTab).append("<div id=\"markdown\"></div>"); | |
// load the script | |
$.getScript("https://cdnjs.cloudflare.com/ajax/libs/showdown/2.1.0/showdown.min.js") | |
.then(function () { | |
// load the text | |
$.get(Configuration.url, function(text) { | |
var converter = new showdown.Converter(), | |
html = converter.makeHtml(text); | |
$("#markdown").append(html); | |
}); | |
}) | |
}(jQuery, Configuration)); |
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
{ | |
"name": "MarkdownViewer", | |
"main": "markdown.js", | |
"file": true, | |
"contentType": [ | |
"text/markdown" | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment