Make diagram configurable

This commit is contained in:
benweet 2014-04-26 01:53:06 +01:00
parent fd901e07ba
commit bf778a9945
16 changed files with 2540 additions and 2380 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
.project .project
.idea
.settings .settings
node_modules node_modules
Thumbs.db Thumbs.db

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,158 +1,226 @@
/*globals Markdown */ /*globals Markdown */
define([ define([
"jquery", "jquery",
"underscore", "underscore",
"utils", "utils",
"logger", "logger",
"classes/Extension", "classes/Extension",
"text!html/markdownExtraSettingsBlock.html", "text!html/markdownExtraSettingsBlock.html",
'google-code-prettify', 'google-code-prettify',
'highlightjs', 'highlightjs',
'crel', 'crel',
'sequence-diagram', 'sequence-diagram',
'flow-chart', 'flow-chart',
'pagedown-extra', 'text!html/tooltipMarkdownExtraDiagrams.html',
], function($, _, utils, logger, Extension, markdownExtraSettingsBlockHTML, prettify, hljs, crel, sequenceDiagram, flowChart) { 'pagedown-extra'
], function($, _, utils, logger, Extension, markdownExtraSettingsBlockHTML, prettify, hljs, crel, sequenceDiagram, flowChart, tooltipMarkdownExtraDiagramsHTML) {
var markdownExtra = new Extension("markdownExtra", "Markdown Extra", true); var markdownExtra = new Extension("markdownExtra", "Markdown Extra", true);
markdownExtra.settingsBlock = markdownExtraSettingsBlockHTML; markdownExtra.settingsBlock = markdownExtraSettingsBlockHTML;
markdownExtra.defaultConfig = { markdownExtra.defaultConfig = {
extensions: [ extensions: [
"fenced_code_gfm", "fenced_code_gfm",
"tables", "tables",
"def_list", "def_list",
"attr_list", "attr_list",
"footnotes", "footnotes",
"smartypants", "smartypants",
"strikethrough", "strikethrough",
"newlines", "newlines"
], ],
intraword: true, intraword: true,
comments: true, comments: true,
highlighter: "prettify" highlighter: "prettify"
}; };
markdownExtra.onLoadSettings = function() { markdownExtra.onLoadSettings = function() {
function hasExtension(extensionName) { function hasExtension(extensionName) {
return _.some(markdownExtra.config.extensions, function(extension) { return _.some(markdownExtra.config.extensions, function(extension) {
return extension == extensionName; return extension == extensionName;
}); });
} }
utils.setInputChecked("#input-markdownextra-fencedcodegfm", hasExtension("fenced_code_gfm"));
utils.setInputChecked("#input-markdownextra-tables", hasExtension("tables"));
utils.setInputChecked("#input-markdownextra-deflist", hasExtension("def_list"));
utils.setInputChecked("#input-markdownextra-attrlist", hasExtension("attr_list"));
utils.setInputChecked("#input-markdownextra-footnotes", hasExtension("footnotes"));
utils.setInputChecked("#input-markdownextra-smartypants", hasExtension("smartypants"));
utils.setInputChecked("#input-markdownextra-strikethrough", hasExtension("strikethrough"));
utils.setInputChecked("#input-markdownextra-newlines", hasExtension("newlines"));
utils.setInputChecked("#input-markdownextra-intraword", markdownExtra.config.intraword);
utils.setInputChecked("#input-markdownextra-comments", markdownExtra.config.comments);
utils.setInputValue("#input-markdownextra-highlighter", markdownExtra.config.highlighter);
};
markdownExtra.onSaveSettings = function(newConfig) { utils.setInputChecked("#input-markdownextra-fencedcodegfm", hasExtension("fenced_code_gfm"));
newConfig.extensions = []; utils.setInputChecked("#input-markdownextra-tables", hasExtension("tables"));
utils.getInputChecked("#input-markdownextra-fencedcodegfm") && newConfig.extensions.push("fenced_code_gfm"); utils.setInputChecked("#input-markdownextra-deflist", hasExtension("def_list"));
utils.getInputChecked("#input-markdownextra-tables") && newConfig.extensions.push("tables"); utils.setInputChecked("#input-markdownextra-attrlist", hasExtension("attr_list"));
utils.getInputChecked("#input-markdownextra-deflist") && newConfig.extensions.push("def_list"); utils.setInputChecked("#input-markdownextra-footnotes", hasExtension("footnotes"));
utils.getInputChecked("#input-markdownextra-attrlist") && newConfig.extensions.push("attr_list"); utils.setInputChecked("#input-markdownextra-smartypants", hasExtension("smartypants"));
utils.getInputChecked("#input-markdownextra-footnotes") && newConfig.extensions.push("footnotes"); utils.setInputChecked("#input-markdownextra-strikethrough", hasExtension("strikethrough"));
utils.getInputChecked("#input-markdownextra-smartypants") && newConfig.extensions.push("smartypants"); utils.setInputChecked("#input-markdownextra-newlines", hasExtension("newlines"));
utils.getInputChecked("#input-markdownextra-strikethrough") && newConfig.extensions.push("strikethrough"); utils.setInputChecked("#input-markdownextra-intraword", markdownExtra.config.intraword);
utils.getInputChecked("#input-markdownextra-newlines") && newConfig.extensions.push("newlines"); utils.setInputChecked("#input-markdownextra-comments", markdownExtra.config.comments);
newConfig.intraword = utils.getInputChecked("#input-markdownextra-intraword"); utils.setInputValue("#input-markdownextra-highlighter", markdownExtra.config.highlighter);
newConfig.comments = utils.getInputChecked("#input-markdownextra-comments"); utils.setInputChecked("#input-markdownextra-diagrams", markdownExtra.config.diagrams);
newConfig.highlighter = utils.getInputValue("#input-markdownextra-highlighter"); };
};
var eventMgr; markdownExtra.onSaveSettings = function(newConfig) {
markdownExtra.onEventMgrCreated = function(eventMgrParameter) { newConfig.extensions = [];
eventMgr = eventMgrParameter; utils.getInputChecked("#input-markdownextra-fencedcodegfm") && newConfig.extensions.push("fenced_code_gfm");
}; utils.getInputChecked("#input-markdownextra-tables") && newConfig.extensions.push("tables");
utils.getInputChecked("#input-markdownextra-deflist") && newConfig.extensions.push("def_list");
utils.getInputChecked("#input-markdownextra-attrlist") && newConfig.extensions.push("attr_list");
utils.getInputChecked("#input-markdownextra-footnotes") && newConfig.extensions.push("footnotes");
utils.getInputChecked("#input-markdownextra-smartypants") && newConfig.extensions.push("smartypants");
utils.getInputChecked("#input-markdownextra-strikethrough") && newConfig.extensions.push("strikethrough");
utils.getInputChecked("#input-markdownextra-newlines") && newConfig.extensions.push("newlines");
newConfig.intraword = utils.getInputChecked("#input-markdownextra-intraword");
newConfig.comments = utils.getInputChecked("#input-markdownextra-comments");
newConfig.highlighter = utils.getInputValue("#input-markdownextra-highlighter");
newConfig.diagrams = utils.getInputChecked("#input-markdownextra-diagrams");
};
var previewContentsElt; var eventMgr;
markdownExtra.onReady = function() { markdownExtra.onEventMgrCreated = function(eventMgrParameter) {
previewContentsElt = document.getElementById('preview-contents'); eventMgr = eventMgrParameter;
}; };
markdownExtra.onPagedownConfigure = function(editor) { var previewContentsElt;
var converter = editor.getConverter(); markdownExtra.onReady = function() {
if(markdownExtra.config.intraword === true) { previewContentsElt = document.getElementById('preview-contents');
var converterOptions = { utils.createTooltip(".tooltip-markdown-extra-diagrams", tooltipMarkdownExtraDiagramsHTML);
_DoItalicsAndBold: function(text) { };
text = text.replace(/([^\w*]|^)(\*\*|__)(?=\S)(.+?[*_]*)(?=\S)\2(?=[^\w*]|$)/g, "$1<strong>$3</strong>");
text = text.replace(/([^\w*]|^)(\*|_)(?=\S)(.+?)(?=\S)\2(?=[^\w*]|$)/g, "$1<em>$3</em>");
return text;
}
};
converter.setOptions(converterOptions);
}
if(markdownExtra.config.comments === true) {
converter.hooks.chain("postConversion", function(text) {
return text.replace(/<!--.*?-->/g, function(wholeMatch) {
return wholeMatch.replace(/^<!---(.+?)-?-->$/, ' <span class="comment label label-danger">$1</span> ');
});
});
}
var extraOptions = { var onAsyncPreview = function(cb) {
extensions: markdownExtra.config.extensions cb();
}; };
markdownExtra.onAsyncPreview = function(cb) {
onAsyncPreview(cb);
};
function doSequenceDiagrams() { var extraOptions;
_.each(previewContentsElt.querySelectorAll('.prettyprint > .language-sequence'), function(elt) { markdownExtra.onInit = function() {
try { var sequenceDiagramEltList, flowChartEltList, highlightEltList, prettifyEltList;
var diagram = sequenceDiagram.parse(elt.textContent); extraOptions = {
var preElt = elt.parentNode; extensions: markdownExtra.config.extensions
var containerElt = crel('div', { };
class: 'sequence-diagram'
});
preElt.parentNode.replaceChild(containerElt, preElt);
diagram.drawSVG(containerElt, {
theme: 'simple'
});
}
catch(e) {
console.error(e);
}
});
_.each(previewContentsElt.querySelectorAll('.prettyprint > .language-flow'), function(elt) {
try {
var chart = flowChart.parse(elt.textContent);
var preElt = elt.parentNode;
var containerElt = crel('div', {
class: 'flow-chart'
});
preElt.parentNode.replaceChild(containerElt, preElt);
chart.drawSVG(containerElt, {
'line-width': 2
});
}
catch(e) {
console.error(e);
}
});
}
if(markdownExtra.config.highlighter == "highlight") {
extraOptions.highlighter = "prettify";
editor.hooks.chain("onPreviewRefresh", function() {
doSequenceDiagrams();
_.each(previewContentsElt.querySelectorAll('.prettyprint > code'), function(elt) {
!elt.highlighted && hljs.highlightBlock(elt);
elt.highlighted = true;
});
});
}
else if(markdownExtra.config.highlighter == "prettify") {
extraOptions.highlighter = "prettify";
editor.hooks.chain("onPreviewRefresh", function() {
doSequenceDiagrams();
prettify.prettyPrint();
});
}
Markdown.Extra.init(converter, extraOptions);
};
return markdownExtra; function doSequenceDiagram(cb) {
if(sequenceDiagramEltList.length === 0) {
return cb();
}
var sequenceDiagramElt = sequenceDiagramEltList.pop();
try {
var diagram = sequenceDiagram.parse(sequenceDiagramElt.textContent);
var preElt = sequenceDiagramElt.parentNode;
var containerElt = crel('div', {
class: 'sequence-diagram'
});
preElt.parentNode.replaceChild(containerElt, preElt);
diagram.drawSVG(containerElt, {
theme: 'simple'
});
}
catch(e) {
}
_.delay(doSequenceDiagram, 0, cb);
}
function doFlowChart(cb) {
if(flowChartEltList.length === 0) {
return cb();
}
var flowChartElt = flowChartEltList.pop();
try {
var chart = flowChart.parse(flowChartElt.textContent);
var preElt = flowChartElt.parentNode;
var containerElt = crel('div', {
class: 'flow-chart'
});
preElt.parentNode.replaceChild(containerElt, preElt);
chart.drawSVG(containerElt, {
'line-width': 2
});
}
catch(e) {
}
_.delay(doFlowChart, 0, cb);
}
function doHighlight(cb) {
if(highlightEltList.length === 0) {
return cb();
}
var highlightElt = highlightEltList.pop();
hljs.highlightBlock(highlightElt);
highlightElt.highlighted = true;
_.delay(doHighlight, 0, cb);
}
function doPrettify(cb) {
if(prettifyEltList.length === 0) {
return cb();
}
var prettifyElt = prettifyEltList.pop();
var html = prettify.prettyPrintOne(prettifyElt.innerHTML);
prettifyElt.innerHTML = html;
prettifyElt.highlighted = true;
_.delay(doPrettify, 0, cb);
}
if(markdownExtra.config.highlighter == "highlight") {
extraOptions.highlighter = "prettify";
var afterHighlight = onAsyncPreview;
onAsyncPreview = function(cb) {
highlightEltList = _.filter(previewContentsElt.querySelectorAll('.prettyprint > code'), function(elt) {
return !elt.highlighted;
});
_.delay(doHighlight, 0, function() {
afterHighlight(cb);
});
};
}
if(markdownExtra.config.highlighter == "prettify") {
extraOptions.highlighter = "prettify";
var afterPrettify = onAsyncPreview;
onAsyncPreview = function(cb) {
prettifyEltList = _.filter(previewContentsElt.querySelectorAll('.prettyprint > code'), function(elt) {
return !elt.highlighted;
});
_.delay(doPrettify, 0, function() {
afterPrettify(cb);
});
};
}
if(markdownExtra.config.diagrams) {
extraOptions.highlighter = "prettify";
var afterDiagrams = onAsyncPreview;
onAsyncPreview = function(cb) {
sequenceDiagramEltList = Array.prototype.slice.call(previewContentsElt.querySelectorAll('.prettyprint > .language-sequence'));
flowChartEltList = Array.prototype.slice.call(previewContentsElt.querySelectorAll('.prettyprint > .language-flow'));
_.delay(doSequenceDiagram, 0, function() {
_.delay(doFlowChart, 0, function() {
afterDiagrams(cb);
});
});
};
}
};
markdownExtra.onPagedownConfigure = function(editor) {
var converter = editor.getConverter();
if(markdownExtra.config.intraword === true) {
var converterOptions = {
_DoItalicsAndBold: function(text) {
text = text.replace(/([^\w*]|^)(\*\*|__)(?=\S)(.+?[*_]*)(?=\S)\2(?=[^\w*]|$)/g, "$1<strong>$3</strong>");
text = text.replace(/([^\w*]|^)(\*|_)(?=\S)(.+?)(?=\S)\2(?=[^\w*]|$)/g, "$1<em>$3</em>");
return text;
}
};
converter.setOptions(converterOptions);
}
if(markdownExtra.config.comments === true) {
converter.hooks.chain("postConversion", function(text) {
return text.replace(/<!--.*?-->/g, function(wholeMatch) {
return wholeMatch.replace(/^<!---(.+?)-?-->$/, ' <span class="comment label label-danger">$1</span> ');
});
});
}
Markdown.Extra.init(converter, extraOptions);
};
return markdownExtra;
}); });

View File

@ -1,73 +1,78 @@
define([ define([
"jquery", "jquery",
"underscore", "underscore",
"utils", "utils",
"mousetrap", "mousetrap",
"classes/Extension", "classes/Extension",
"text!extensions/shortcutsDefaultMapping.settings", "text!extensions/shortcutsDefaultMapping.settings",
"text!html/shortcutsSettingsBlock.html", "text!html/shortcutsSettingsBlock.html",
], function($, _, utils, mousetrap, Extension, shortcutsDefaultMapping, shortcutsSettingsBlockHTML) { "text!html/tooltipSettingsShortcutsExtension.html"
], function($, _, utils, mousetrap, Extension, shortcutsDefaultMapping, shortcutsSettingsBlockHTML, tooltipSettingsShortcutsExtensionHTML) {
var shortcuts = new Extension("shortcuts", "Shortcuts", true, true); var shortcuts = new Extension("shortcuts", "Shortcuts", true, true);
shortcuts.settingsBlock = shortcutsSettingsBlockHTML; shortcuts.settingsBlock = shortcutsSettingsBlockHTML;
shortcuts.defaultConfig = { shortcuts.defaultConfig = {
mapping: shortcutsDefaultMapping, mapping: shortcutsDefaultMapping
}; };
var eventMgr; var eventMgr;
var pagedownEditor; var pagedownEditor;
shortcuts.onEventMgrCreated = function(eventMgrParameter) { shortcuts.onEventMgrCreated = function(eventMgrParameter) {
eventMgr = eventMgrParameter; eventMgr = eventMgrParameter;
eventMgr.addListener('onPagedownConfigure', function(pagedownEditorParam) { eventMgr.addListener('onPagedownConfigure', function(pagedownEditorParam) {
pagedownEditor = pagedownEditorParam; pagedownEditor = pagedownEditorParam;
}); });
}; };
shortcuts.onLoadSettings = function() { shortcuts.onLoadSettings = function() {
utils.setInputValue("#textarea-shortcuts-mapping", shortcuts.config.mapping); utils.setInputValue("#textarea-shortcuts-mapping", shortcuts.config.mapping);
}; };
shortcuts.onSaveSettings = function(newConfig, event) { shortcuts.onSaveSettings = function(newConfig, event) {
newConfig.code = utils.getInputValue("#textarea-shortcuts-mapping"); newConfig.code = utils.getInputValue("#textarea-shortcuts-mapping");
try { try {
/*jshint evil: true */ /*jshint evil: true */
eval('var test = ' + newConfig.code); eval('var test = ' + newConfig.code);
} }
catch(e) { catch(e) {
eventMgr.onError(e); eventMgr.onError(e);
// Mark the textarea as error // Mark the textarea as error
utils.getInputTextValue("#textarea-shortcuts-mapping", event, /^$/); utils.getInputTextValue("#textarea-shortcuts-mapping", event, /^$/);
} }
}; };
/*jshint unused:false */ /*jshint unused:false */
function bindPagedownButton(buttonName) { function bindPagedownButton(buttonName) {
return function(evt) { return function(evt) {
pagedownEditor.uiManager.doClick(pagedownEditor.uiManager.buttons[buttonName]); pagedownEditor.uiManager.doClick(pagedownEditor.uiManager.buttons[buttonName]);
evt.preventDefault(); evt.preventDefault();
}; };
} }
function expand(text, replacement) { function expand(text, replacement) {
utils.defer(function() { utils.defer(function() {
require('editor').replacePreviousText(text, replacement); require('editor').replacePreviousText(text, replacement);
}); });
} }
/*jshint unused:true */ /*jshint unused:true */
shortcuts.onInit = function() { shortcuts.onInit = function() {
try { try {
/*jshint evil: true */ /*jshint evil: true */
var shortcutMap; var shortcutMap;
eval('shortcutMap = ' + shortcuts.config.mapping); eval('shortcutMap = ' + shortcuts.config.mapping);
_.each(shortcutMap, function(func, shortcut) { _.each(shortcutMap, function(func, shortcut) {
mousetrap.bind(shortcut, func); mousetrap.bind(shortcut, func);
}); });
} }
catch(e) { catch(e) {
console.error(e); console.error(e);
} }
}; };
return shortcuts; shortcuts.onReady = function() {
utils.createTooltip(".tooltip-shortcuts-extension", tooltipSettingsShortcutsExtensionHTML);
};
return shortcuts;
}); });

View File

@ -1,65 +1,70 @@
define([ define([
"jquery", "jquery",
"underscore", "underscore",
"utils", "utils",
"classes/Extension", "classes/Extension",
"fileSystem", "fileSystem",
"settings", "settings",
"text!html/userCustomSettingsBlock.html", "text!html/userCustomSettingsBlock.html",
], function($, _, utils, Extension, fileSystem, settings, userCustomSettingsBlockHTML) { "text!html/tooltipUserCustomExtension.html"
], function($, _, utils, Extension, fileSystem, settings, userCustomSettingsBlockHTML, tooltipUserCustomExtensionHTML) {
var userCustom = new Extension("userCustom", "UserCustom extension", true); var userCustom = new Extension("userCustom", "UserCustom extension", true);
userCustom.settingsBlock = userCustomSettingsBlockHTML; userCustom.settingsBlock = userCustomSettingsBlockHTML;
userCustom.defaultConfig = { userCustom.defaultConfig = {
code: "", code: ""
}; };
var fileMgr; var fileMgr;
userCustom.onFileMgrCreated = function(fileMgrParameter) { userCustom.onFileMgrCreated = function(fileMgrParameter) {
fileMgr = fileMgrParameter; fileMgr = fileMgrParameter;
}; };
var synchronizer; var synchronizer;
userCustom.onSynchronizerCreated = function(synchronizerParameter) { userCustom.onSynchronizerCreated = function(synchronizerParameter) {
synchronizer = synchronizerParameter; synchronizer = synchronizerParameter;
}; };
var publisher; var publisher;
userCustom.onPublisherCreated = function(publisherParameter) { userCustom.onPublisherCreated = function(publisherParameter) {
publisher = publisherParameter; publisher = publisherParameter;
}; };
var eventMgr; var eventMgr;
userCustom.onEventMgrCreated = function(eventMgrParameter) { userCustom.onEventMgrCreated = function(eventMgrParameter) {
eventMgr = eventMgrParameter; eventMgr = eventMgrParameter;
}; };
userCustom.onLoadSettings = function() { userCustom.onLoadSettings = function() {
utils.setInputValue("#textarea-usercustom-code", userCustom.config.code); utils.setInputValue("#textarea-usercustom-code", userCustom.config.code);
}; };
userCustom.onSaveSettings = function(newConfig, event) { userCustom.onSaveSettings = function(newConfig, event) {
newConfig.code = utils.getInputValue("#textarea-usercustom-code"); newConfig.code = utils.getInputValue("#textarea-usercustom-code");
try { try {
/*jshint evil: true */ /*jshint evil: true */
eval(newConfig.code); eval(newConfig.code);
} }
catch(e) { catch(e) {
eventMgr.onError(e); eventMgr.onError(e);
// Mark the textarea as error // Mark the textarea as error
utils.getInputTextValue("#textarea-usercustom-code", event, /^$/); utils.getInputTextValue("#textarea-usercustom-code", event, /^$/);
} }
}; };
userCustom.onInit = function() { userCustom.onInit = function() {
try { try {
/*jshint evil: true */ /*jshint evil: true */
eval(userCustom.config.code); eval(userCustom.config.code);
} }
catch(e) { catch(e) {
console.error(e); console.error(e);
} }
}; };
return userCustom; userCustom.onReady = function() {
utils.createTooltip(".tooltip-usercustom-extension", tooltipUserCustomExtensionHTML);
};
return userCustom;
}); });

View File

@ -198,7 +198,7 @@
</ul> </ul>
<div class="input-group"> <div class="input-group">
<span class="input-group-addon"><i class="icon-search"></i></span><input <span class="input-group-addon"><i class="icon-search"></i></span><input
type="text" class="form-control" placeholder="Find document"></input> type="text" class="form-control" placeholder="Find document" />
</div> </div>
</div> </div>
<div class="panel-content"> <div class="panel-content">
@ -278,7 +278,7 @@
<div class="input-group"> <div class="input-group">
<span class="input-group-addon"><i class="icon-globe"></i></span><input <span class="input-group-addon"><i class="icon-globe"></i></span><input
id="input-insert-link" type="text" class="col-sm-5 form-control" id="input-insert-link" type="text" class="col-sm-5 form-control"
placeholder='http://example.com/ "optional title"'></input> placeholder='http://example.com/ "optional title"' />
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
@ -305,7 +305,7 @@
<div class="input-group"> <div class="input-group">
<span class="input-group-addon"><i class="icon-picture"></i></span><input <span class="input-group-addon"><i class="icon-picture"></i></span><input
id="input-insert-image" type="text" class="col-sm-5 form-control" id="input-insert-image" type="text" class="col-sm-5 form-control"
placeholder='http://example.com/image.jpg "optional title"'></input> placeholder='http://example.com/image.jpg "optional title"' />
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
@ -963,7 +963,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-4 control-label" <label class="col-sm-4 control-label"
for="input-settings-gdrive-multiaccount">Google Drive multi-accounts</a> for="input-settings-gdrive-multiaccount">Google Drive multi-accounts
</label> </label>
<div class="col-sm-7"> <div class="col-sm-7">
<select id="input-settings-gdrive-multiaccount" class="form-control"> <select id="input-settings-gdrive-multiaccount" class="form-control">
@ -1082,7 +1082,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-4 control-label" <label class="col-sm-4 control-label"
for="input-settings-markdown-mime-type">Markdown MIME type</a> for="input-settings-markdown-mime-type">Markdown MIME type
</label> </label>
<div class="col-sm-7"> <div class="col-sm-7">
<select id="input-settings-markdown-mime-type" class="form-control"> <select id="input-settings-markdown-mime-type" class="form-control">
@ -1159,7 +1159,7 @@
data-dismiss="modal"><i class="icon-help-circled"></i> data-dismiss="modal"><i class="icon-help-circled"></i>
Welcome document</a> <a href="#" Welcome document</a> <a href="#"
class="btn btn-block btn-primary action-welcome-tour" class="btn btn-block btn-primary action-welcome-tour"
data-dismiss="modal" data-dismiss="modal"><i data-dismiss="modal"><i
class="icon-help-circled"></i> Welcome tour</a> class="icon-help-circled"></i> Welcome tour</a>
</div> </div>
<div class="tab-pane-button-container"> <div class="tab-pane-button-container">

View File

@ -100,6 +100,15 @@
</select> </select>
</div> </div>
</div> </div>
<div class="form-group">
<label class="col-sm-4 control-label"
for="input-markdownextra-diagrams">Diagrams <a href="#" class="tooltip-markdown-extra-diagrams">(?)</a></label>
<div class="col-sm-7">
<div class="checkbox">
<input type="checkbox" id="input-markdownextra-diagrams">
</div>
</div>
</div>
</div> </div>
<span class="help-block pull-right"><a target="_blank" <span class="help-block pull-right"><a target="_blank"
href="https://github.com/jmcmanus/pagedown-extra">More info</a></span> href="https://github.com/jmcmanus/pagedown-extra">More info</a></span>

View File

@ -0,0 +1,23 @@
You can create sequence diagrams like this:
<br />
<br />
```sequence<br />
Alice-&gt;Bob: Hello Bob, how are you?
Bob--&gt;Alice: I am good thanks!
```<br />
<a target="_blank" href="http://bramp.github.io/js-sequence-diagrams/">More info</a>
<br />
<br />
Or flow charts like this:
<br />
<br />
```flow<br />
st=&gt;start: Start<br />
e=&gt;end<br />
op=&gt;operation: My Operation<br />
cond=&gt;condition: Yes or No?<br />
st-&gt;op-&gt;cond<br />
cond(yes)-&gt;e<br />
cond(no)-&gt;op<br />
```<br />
<a target="_blank" href="http://adrai.github.io/flowchart.js/">More info</a>

View File

@ -230,6 +230,15 @@ define([
version = "v18"; version = "v18";
} }
if(version == 'v18') {
if(_.has(localStorage, 'settings')) {
settings = JSON.parse(localStorage.settings);
((settings.extensionSettings || {}).markdownExtra || {}).diagrams = true;
localStorage.settings = JSON.stringify(settings);
}
version = "v19";
}
localStorage.version = version; localStorage.version = version;
return localStorage; return localStorage;
}); });

View File

@ -132,6 +132,7 @@ hr {
.sequence-diagram, .flow-chart { .sequence-diagram, .flow-chart {
text-align: center; text-align: center;
margin-bottom: @p-margin;
text { text {
font-size: 1em !important; font-size: 1em !important;
font-family: @font-family-sans-serif !important; font-family: @font-family-sans-serif !important;

View File

@ -256,6 +256,10 @@ a {
} }
} }
.text-danger:hover {
color: @state-danger-text;
}
.layout-panel() { .layout-panel() {
position: absolute; position: absolute;
top: 0; top: 0;

File diff suppressed because it is too large Load Diff