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
.idea
.settings
node_modules
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 */
define([
"jquery",
"underscore",
"utils",
"logger",
"classes/Extension",
"text!html/markdownExtraSettingsBlock.html",
'google-code-prettify',
'highlightjs',
'crel',
'sequence-diagram',
'flow-chart',
'pagedown-extra',
], function($, _, utils, logger, Extension, markdownExtraSettingsBlockHTML, prettify, hljs, crel, sequenceDiagram, flowChart) {
"jquery",
"underscore",
"utils",
"logger",
"classes/Extension",
"text!html/markdownExtraSettingsBlock.html",
'google-code-prettify',
'highlightjs',
'crel',
'sequence-diagram',
'flow-chart',
'text!html/tooltipMarkdownExtraDiagrams.html',
'pagedown-extra'
], function($, _, utils, logger, Extension, markdownExtraSettingsBlockHTML, prettify, hljs, crel, sequenceDiagram, flowChart, tooltipMarkdownExtraDiagramsHTML) {
var markdownExtra = new Extension("markdownExtra", "Markdown Extra", true);
markdownExtra.settingsBlock = markdownExtraSettingsBlockHTML;
markdownExtra.defaultConfig = {
extensions: [
"fenced_code_gfm",
"tables",
"def_list",
"attr_list",
"footnotes",
"smartypants",
"strikethrough",
"newlines",
],
intraword: true,
comments: true,
highlighter: "prettify"
};
var markdownExtra = new Extension("markdownExtra", "Markdown Extra", true);
markdownExtra.settingsBlock = markdownExtraSettingsBlockHTML;
markdownExtra.defaultConfig = {
extensions: [
"fenced_code_gfm",
"tables",
"def_list",
"attr_list",
"footnotes",
"smartypants",
"strikethrough",
"newlines"
],
intraword: true,
comments: true,
highlighter: "prettify"
};
markdownExtra.onLoadSettings = function() {
function hasExtension(extensionName) {
return _.some(markdownExtra.config.extensions, function(extension) {
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.onLoadSettings = function() {
function hasExtension(extensionName) {
return _.some(markdownExtra.config.extensions, function(extension) {
return extension == extensionName;
});
}
markdownExtra.onSaveSettings = function(newConfig) {
newConfig.extensions = [];
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");
};
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);
utils.setInputChecked("#input-markdownextra-diagrams", markdownExtra.config.diagrams);
};
var eventMgr;
markdownExtra.onEventMgrCreated = function(eventMgrParameter) {
eventMgr = eventMgrParameter;
};
markdownExtra.onSaveSettings = function(newConfig) {
newConfig.extensions = [];
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;
markdownExtra.onReady = function() {
previewContentsElt = document.getElementById('preview-contents');
};
var eventMgr;
markdownExtra.onEventMgrCreated = function(eventMgrParameter) {
eventMgr = eventMgrParameter;
};
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> ');
});
});
}
var previewContentsElt;
markdownExtra.onReady = function() {
previewContentsElt = document.getElementById('preview-contents');
utils.createTooltip(".tooltip-markdown-extra-diagrams", tooltipMarkdownExtraDiagramsHTML);
};
var extraOptions = {
extensions: markdownExtra.config.extensions
};
var onAsyncPreview = function(cb) {
cb();
};
markdownExtra.onAsyncPreview = function(cb) {
onAsyncPreview(cb);
};
function doSequenceDiagrams() {
_.each(previewContentsElt.querySelectorAll('.prettyprint > .language-sequence'), function(elt) {
try {
var diagram = sequenceDiagram.parse(elt.textContent);
var preElt = elt.parentNode;
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);
};
var extraOptions;
markdownExtra.onInit = function() {
var sequenceDiagramEltList, flowChartEltList, highlightEltList, prettifyEltList;
extraOptions = {
extensions: markdownExtra.config.extensions
};
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([
"jquery",
"underscore",
"utils",
"mousetrap",
"classes/Extension",
"text!extensions/shortcutsDefaultMapping.settings",
"text!html/shortcutsSettingsBlock.html",
], function($, _, utils, mousetrap, Extension, shortcutsDefaultMapping, shortcutsSettingsBlockHTML) {
"jquery",
"underscore",
"utils",
"mousetrap",
"classes/Extension",
"text!extensions/shortcutsDefaultMapping.settings",
"text!html/shortcutsSettingsBlock.html",
"text!html/tooltipSettingsShortcutsExtension.html"
], function($, _, utils, mousetrap, Extension, shortcutsDefaultMapping, shortcutsSettingsBlockHTML, tooltipSettingsShortcutsExtensionHTML) {
var shortcuts = new Extension("shortcuts", "Shortcuts", true, true);
shortcuts.settingsBlock = shortcutsSettingsBlockHTML;
shortcuts.defaultConfig = {
mapping: shortcutsDefaultMapping,
};
var shortcuts = new Extension("shortcuts", "Shortcuts", true, true);
shortcuts.settingsBlock = shortcutsSettingsBlockHTML;
shortcuts.defaultConfig = {
mapping: shortcutsDefaultMapping
};
var eventMgr;
var pagedownEditor;
shortcuts.onEventMgrCreated = function(eventMgrParameter) {
eventMgr = eventMgrParameter;
eventMgr.addListener('onPagedownConfigure', function(pagedownEditorParam) {
pagedownEditor = pagedownEditorParam;
});
};
var eventMgr;
var pagedownEditor;
shortcuts.onEventMgrCreated = function(eventMgrParameter) {
eventMgr = eventMgrParameter;
eventMgr.addListener('onPagedownConfigure', function(pagedownEditorParam) {
pagedownEditor = pagedownEditorParam;
});
};
shortcuts.onLoadSettings = function() {
utils.setInputValue("#textarea-shortcuts-mapping", shortcuts.config.mapping);
};
shortcuts.onLoadSettings = function() {
utils.setInputValue("#textarea-shortcuts-mapping", shortcuts.config.mapping);
};
shortcuts.onSaveSettings = function(newConfig, event) {
newConfig.code = utils.getInputValue("#textarea-shortcuts-mapping");
try {
/*jshint evil: true */
eval('var test = ' + newConfig.code);
}
catch(e) {
eventMgr.onError(e);
// Mark the textarea as error
utils.getInputTextValue("#textarea-shortcuts-mapping", event, /^$/);
}
};
shortcuts.onSaveSettings = function(newConfig, event) {
newConfig.code = utils.getInputValue("#textarea-shortcuts-mapping");
try {
/*jshint evil: true */
eval('var test = ' + newConfig.code);
}
catch(e) {
eventMgr.onError(e);
// Mark the textarea as error
utils.getInputTextValue("#textarea-shortcuts-mapping", event, /^$/);
}
};
/*jshint unused:false */
function bindPagedownButton(buttonName) {
return function(evt) {
pagedownEditor.uiManager.doClick(pagedownEditor.uiManager.buttons[buttonName]);
evt.preventDefault();
};
}
/*jshint unused:false */
function bindPagedownButton(buttonName) {
return function(evt) {
pagedownEditor.uiManager.doClick(pagedownEditor.uiManager.buttons[buttonName]);
evt.preventDefault();
};
}
function expand(text, replacement) {
utils.defer(function() {
require('editor').replacePreviousText(text, replacement);
});
}
function expand(text, replacement) {
utils.defer(function() {
require('editor').replacePreviousText(text, replacement);
});
}
/*jshint unused:true */
shortcuts.onInit = function() {
try {
/*jshint evil: true */
var shortcutMap;
eval('shortcutMap = ' + shortcuts.config.mapping);
_.each(shortcutMap, function(func, shortcut) {
mousetrap.bind(shortcut, func);
});
}
catch(e) {
console.error(e);
}
};
/*jshint unused:true */
shortcuts.onInit = function() {
try {
/*jshint evil: true */
var shortcutMap;
eval('shortcutMap = ' + shortcuts.config.mapping);
_.each(shortcutMap, function(func, shortcut) {
mousetrap.bind(shortcut, func);
});
}
catch(e) {
console.error(e);
}
};
return shortcuts;
shortcuts.onReady = function() {
utils.createTooltip(".tooltip-shortcuts-extension", tooltipSettingsShortcutsExtensionHTML);
};
return shortcuts;
});

View File

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

View File

@ -198,7 +198,7 @@
</ul>
<div class="input-group">
<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 class="panel-content">
@ -278,7 +278,7 @@
<div class="input-group">
<span class="input-group-addon"><i class="icon-globe"></i></span><input
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 class="modal-footer">
@ -305,7 +305,7 @@
<div class="input-group">
<span class="input-group-addon"><i class="icon-picture"></i></span><input
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 class="modal-footer">
@ -963,7 +963,7 @@
</div>
<div class="form-group">
<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>
<div class="col-sm-7">
<select id="input-settings-gdrive-multiaccount" class="form-control">
@ -1082,7 +1082,7 @@
</div>
<div class="form-group">
<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>
<div class="col-sm-7">
<select id="input-settings-markdown-mime-type" class="form-control">
@ -1159,7 +1159,7 @@
data-dismiss="modal"><i class="icon-help-circled"></i>
Welcome document</a> <a href="#"
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>
</div>
<div class="tab-pane-button-container">

View File

@ -100,6 +100,15 @@
</select>
</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>
<span class="help-block pull-right"><a target="_blank"
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";
}
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;
return localStorage;
});

View File

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

View File

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

File diff suppressed because it is too large Load Diff