Stackedit/js/extensions/markdown-extra.js

45 lines
1.5 KiB
JavaScript
Raw Normal View History

2013-05-27 19:45:33 +00:00
define([
"utils",
"lib/Markdown.Extra"
], function(utils) {
2013-05-25 00:34:04 +00:00
var markdownExtra = {
extensionId: "markdownExtra",
extensionName: "Markdown Extra",
2013-05-25 18:13:59 +00:00
optional: true,
2013-05-25 00:34:04 +00:00
defaultConfig: {
prettify: true
2013-05-25 18:13:59 +00:00
},
settingsBloc: [
'<p>Adds extra features to the original Markdown syntax.</p>',
'<div class="form-horizontal">',
'<div class="control-group">',
'<label class="control-label" for="input-markdownextra-prettify">Prettify syntax highlighting</label>',
'<div class="controls">',
'<input type="checkbox" id="input-markdownextra-prettify">',
'</div>',
'</div>',
'</div>'
].join("")
};
markdownExtra.onLoadSettings = function() {
utils.setInputChecked("#input-markdownextra-prettify", markdownExtra.config.prettify);
};
markdownExtra.onSaveSettings = function(newConfig, event) {
newConfig.prettify = utils.getInputChecked("#input-markdownextra-prettify");
2013-05-25 00:34:04 +00:00
};
markdownExtra.onEditorConfigure = function(editor) {
var converter = editor.getConverter();
var options = {};
if(markdownExtra.config.prettify === true) {
options.highlighter = "prettify";
editor.hooks.chain("onPreviewRefresh", prettyPrint);
}
Markdown.Extra.init(converter, options);
};
return markdownExtra;
});