2013-05-27 19:45:33 +00:00
|
|
|
define([
|
|
|
|
"utils",
|
2013-06-02 00:38:23 +00:00
|
|
|
"libs/Markdown.Extra"
|
2013-05-27 19:45:33 +00:00
|
|
|
], function(utils) {
|
2013-05-29 19:55:23 +00:00
|
|
|
|
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: {
|
2013-05-29 19:55:23 +00:00
|
|
|
prettify: true
|
|
|
|
},
|
2013-05-25 18:13:59 +00:00
|
|
|
settingsBloc: [
|
2013-05-29 19:55:23 +00:00
|
|
|
'<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("")
|
2013-05-25 18:13:59 +00:00
|
|
|
};
|
2013-05-29 19:55:23 +00:00
|
|
|
|
2013-05-25 18:13:59 +00:00
|
|
|
markdownExtra.onLoadSettings = function() {
|
2013-05-29 19:55:23 +00:00
|
|
|
utils.setInputChecked("#input-markdownextra-prettify", markdownExtra.config.prettify);
|
2013-05-25 18:13:59 +00:00
|
|
|
};
|
2013-05-29 19:55:23 +00:00
|
|
|
|
2013-05-25 18:13:59 +00:00
|
|
|
markdownExtra.onSaveSettings = function(newConfig, event) {
|
2013-05-29 19:55:23 +00:00
|
|
|
newConfig.prettify = utils.getInputChecked("#input-markdownextra-prettify");
|
2013-05-25 00:34:04 +00:00
|
|
|
};
|
2013-05-29 19:55:23 +00:00
|
|
|
|
2013-05-25 00:34:04 +00:00
|
|
|
markdownExtra.onEditorConfigure = function(editor) {
|
2013-05-29 19:55:23 +00:00
|
|
|
var converter = editor.getConverter();
|
|
|
|
var options = {};
|
|
|
|
if(markdownExtra.config.prettify === true) {
|
|
|
|
options.highlighter = "prettify";
|
|
|
|
editor.hooks.chain("onPreviewRefresh", prettyPrint);
|
|
|
|
}
|
|
|
|
Markdown.Extra.init(converter, options);
|
|
|
|
};
|
|
|
|
|
2013-05-25 00:34:04 +00:00
|
|
|
return markdownExtra;
|
|
|
|
});
|