tylingsoft / markdown-plus Goto Github PK
View Code? Open in Web Editor NEWMarkdown editor with extra features.
Home Page: http://mdp.tylingsoft.com/
Markdown editor with extra features.
Home Page: http://mdp.tylingsoft.com/
RT
在md文档中插入iframe代码后,每次用markdown plus打开文件时会自动启动浏览器并显示iframe中的内容,切换回markdown plus继续编辑后,也会不断地跳到浏览器窗口,无法继续正常写作。
In basic mode, only common markdown and GFM are supported. Content created is fully supported on GitHub.
In extended mode, all markdown extension syntax is supported, such as flowchats, latex math...etc.
Two modes should be switchable in preferences modal.
How to hide preview panel ,use javascript?I don't want preview panel is displaying on page load.It's unfriendly to mobile user.
内容再丰富些,越做越好
mermaid 版本不支持 chrome 48, see mermaid-js/mermaid#281
需要更新 mermaid 的版本
Some one is requesting this feature.
Footnote is not part of markdown specification, It's part of MultiMarkdown specification:
https://github.com/fletcher/MultiMarkdown/wiki/MultiMarkdown-Syntax-Guide#footnotes
弱不堪用。
ctrl+n = new file 而不是next line
ctrl+shift+-根本不能撤销
不能打开上次编辑的文档,每次都要重新打开
程序经常假死
值60块?
Hi, I would like to ask which function in Markdown Plus is used for parsing Markdown?
I would like to use JavaScript for parsing codes, but I couldn't find that function.
如题,已在app和在线模式都进行了测试,测试内容有1400+行,进行编辑时有明显的1-2秒卡顿
环境:
Markdown Plus(Version 1.4.4)
OSX Yosemite 10.10.4
MacBook Pro (Retina, 13-inch, Late 2013)
2.4 GHz Intel Core i5
8 GB 1600 MHz DDR3
目前数学公式似乎只能由
``math
x ^ 2 + y ^ 2 = z ^ 2
``
给出,是否考虑加入行内公式呢? 例如:
Let $latex S(n)$ be the n-th partial sum of series $latex a_n$.
另外我很喜欢markdown-plus的LaTeX显示,因为比Mou加载速度更快!
_.debounce function is replaced with plain JS. (sorry I dont use git)
var editor;
//http://davidwalsh.name/javascript-debounce-function
function debounce(func, wait, immediate) {
var timeout;
return function() {
var context = this, args = arguments;
var later = function() {
timeout = null;
if (!immediate) func.apply(context, args);
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) func.apply(context, args);
};
};
$(document).ready(function() {
$.getJSON('bower.json', function(json) {
$('#version-string').html(json.version); // 从 bower.json 读取版本号
});
// 构造上中右三个面板
$('body').layout({
resizerDblClickToggle: false,
resizable: false,
slidable: false,
togglerLength_open: '100%',
togglerLength_closed: '100%',
north: {
size: '1px', // 只是占位,真实大小由内容决定
togglerTip_open: 'Hide Toolbar',
togglerTip_closed: 'Show Toolbar'
},
east: {
size: '50%',
togglerTip_open: 'Hide Preview',
togglerTip_closed: 'Show Preview',
onresize: function() {
editor.session.setUseWrapMode(false); // ACE的wrap貌似有问题,这里手动触发一下。
editor.session.setUseWrapMode(true);
}
}
});
// 左侧编辑器
editor = ace.edit("editor");
editor.$blockScrolling = Infinity;
editor.renderer.setShowPrintMargin(false);
editor.session.setMode("ace/mode/markdown");
editor.session.setUseWrapMode(true);
editor.setFontSize('14px');
editor.focus();
// 编辑器的一些拓展方法
editor.selection.smartRange = function() {
var range = editor.selection.getRange();
if(!range.isEmpty()) {
return range; // 用户手动选中了一些文字,直接用这个
}
// 没有选中任何东西
var _range = range; // 备份原始range
range = editor.selection.getWordRange(range.start.row, range.start.column); // 当前单词的range
if(editor.session.getTextRange(range).trim().length == 0) { // 选中的东西是空或者全空白
range = _range; // 还使用原始的range
}
return range;
};
// 设置marked
var renderer = new marked.Renderer();
renderer.listitem = function(text) {
if(!/^\[[ x]\]\s/.test(text)) {
return marked.Renderer.prototype.listitem(text);
}
// 任务列表
var checkbox = $('<input type="checkbox" class="taskbox" disabled="disabled"/>');
if(/^\[x\]\s/.test(text)) { // 完成的任务列表
checkbox.attr('checked', true);
}
return $(marked.Renderer.prototype.listitem(text.substring(4))).addClass('nostyle').prepend(checkbox)[0].outerHTML;
}
var mermaidError;
mermaid.parseError = function(err, hash){
mermaidError = err;
};
renderer.code = function(code, language) {
code = code.trim();
var firstLine = code.split(/\n/)[0].trim();
if(language === 'math') { // 数学公式
var tex = '';
code.split(/\n\n/).forEach(function(line){ // 连续两个换行,则开始下一个公式
line = line.trim();
if(line.length > 0) {
try {
tex += katex.renderToString(line, { displayMode: true });
} catch(err) {
tex += '<pre>' + err + '</pre>';
}
}
});
return tex;
} else if(firstLine === 'sequenceDiagram' || firstLine.match(/^graph (?:TB|BT|RL|LR|TD);?$/)) {
if(firstLine === 'sequenceDiagram') {
code += '\n'; // 如果末尾没有空行,则语法错误
}
if(mermaid.parse(code)) {
return '<div class="mermaid">' + code + '</div>';
} else {
return '<pre>' + mermaidError + '</pre>';
}
} else {
return marked.Renderer.prototype.code.apply(this, arguments);
}
}
marked.setOptions({
renderer: renderer,
gfm: true,
tables: true,
breaks: false,
pedantic: false,
sanitize: false,
smartLists: true,
smartypants: true
});
// 实时监听用户的编辑
editor.session.on('change', function() {
lazy_change();
});
var lazy_change = debounce(function() { // 用户停止输入256毫秒之后才会触发
$('.markdown-body').empty().append(marked(editor.session.getValue())); // 实时预览
console.log(editor.session.getValue())
$('pre').addClass('prettyprint').addClass('linenums');
prettyPrint(); // 语法高亮
$('img[src^="emoji/"]').each(function() { // 转换emoji路径
$(this).attr('src', 'bower_components/emoji-icons/' + $(this).attr('src').substring(6) + '.png');
});
mermaid.init(); // 生成流程图,顺序图等
}, 256, false);
// h1 - h6 heading
$('.heading-icon').click(function() {
var level = $(this).data('level');
var p = editor.getCursorPosition();
p.column += level + 1; // 光标位置会产生偏移
editor.navigateTo(editor.getSelectionRange().start.row, 0); // navigateLineStart 在 wrap 的时候有问题
editor.insert('#'.repeat(level) + ' ');
editor.moveCursorToPosition(p); // 恢复光标位置
editor.focus();
});
// styling icons
$('.styling-icon').click(function() {
var modifier = $(this).data('modifier');
var range = editor.selection.smartRange();
var p = editor.getCursorPosition();
p.column += modifier.length; // 光标位置会产生偏移
editor.session.replace(range, modifier + editor.session.getTextRange(range) + modifier);
editor.moveCursorToPosition(p); // 恢复光标位置
editor.selection.clearSelection(); // 不知为何上一个语句会选中一部分文字
editor.focus();
});
// <hr/>
$('#horizontal-rule').click(function() {
var p = editor.getCursorPosition();
if(p.column == 0) { // 光标在行首
editor.selection.clearSelection();
editor.insert('\n---\n');
} else {
editor.navigateTo(editor.getSelectionRange().start.row, Number.MAX_VALUE); // navigateLineEnd 在 wrap 的时候有问题
editor.insert('\n\n---\n');
}
editor.focus();
});
// list icons
$('.list-icon').click(function() {
var prefix = $(this).data('prefix');
var p = editor.getCursorPosition();
p.column += prefix.length; // 光标位置会产生偏移
var range = editor.selection.getRange();
for(var i = range.start.row + 1; i < range.end.row + 2; i++) {
editor.gotoLine(i);
editor.insert(prefix);
}
editor.moveCursorToPosition(p); // 恢复光标位置
editor.focus();
});
$('#link-icon').click(function() {
var range = editor.selection.smartRange();
var text = editor.session.getTextRange(range);
if(text.trim().length == 0) {
text = 'link description';
}
editor.session.replace(range, '[' + text +'](http://example.com/ "optional title")');
editor.focus();
});
$('#image-icon').click(function() {
var text = editor.session.getTextRange(editor.selection.getRange()).trim();
if(text.length == 0) {
text = 'image description';
}
editor.insert('![' + text + '](http://example.com/example.png)');
editor.focus();
});
$('#code-icon').click(function() {
var text = editor.session.getTextRange(editor.selection.getRange()).trim();
if(text.length == 0) {
text = 'enter code here';
}
editor.insert('\n```\n' + text + '\n```\n');
editor.focus();
});
$('#table-icon').click(function() {
var tableTemplate = 'header 1 | header 2\n---|---\nrow 1 col 1 | row 1 col 2\nrow 2 col 1 | row 2 col 2';
editor.insert(''); // 删除选中的部分
var p = editor.getCursorPosition();
if(p.column == 0) { // 光标在行首
editor.selection.clearSelection();
editor.insert('\n' + tableTemplate + '\n\n');
} else {
editor.navigateTo(editor.getSelectionRange().start.row, Number.MAX_VALUE);
editor.insert('\n\n' + tableTemplate + '\n');
}
editor.focus();
});
// emoji icon
$(document).on('opened', '#emoji-modal', function() {
$('#emoji-code').focus();
});
$('#emoji-code').keyup(function(e) {
if(e.which == 13) { // 回车键确认
$('#emoji-confirm').click();
}
});
$(document).on('confirm', '#emoji-modal', function() {
var emoji_code = $('#emoji-code').val().trim();
if(emoji_code.length > 0) {
editor.insert('<img src="emoji/' + emoji_code + '" width="18"/>');
$('#emoji-code').val('');
}
});
// Font Awesome icon
$(document).on('opened', '#fa-modal', function() {
$('#fa-code').focus();
});
$('#fa-code').keyup(function(e) {
if(e.which == 13) { // 回车键确认
$('#fa-confirm').click();
}
});
$(document).on('confirm', '#fa-modal', function() {
var fa_code = $('#fa-code').val().trim();
if(fa_code.length > 0) {
editor.insert('<i class="fa fa-' + fa_code + '"/>');
$('#fa-code').val('');
}
});
// Ionicons icon
$(document).on('opened', '#ion-modal', function() {
$('#ion-code').focus();
});
$('#ion-code').keyup(function(e) {
if(e.which == 13) { // 回车键确认
$('#ion-confirm').click();
}
});
$(document).on('confirm', '#ion-modal', function() {
var ion_code = $('#ion-code').val().trim();
if(ion_code.length > 0) {
editor.insert('<i class="icon ion-' + ion_code + '"/>');
$('#ion-code').val('');
}
});
$('#math-icon').click(function(){
var text = editor.session.getTextRange(editor.selection.getRange()).trim();
if(text.length == 0) {
text = 'E = mc^2';
}
editor.insert('\n```math\n' + text + '\n```\n');
editor.focus();
});
$('#flow-icon').click(function(){
var text = editor.session.getTextRange(editor.selection.getRange()).trim();
if(text.length == 0) {
text = 'graph LR\nA-->B';
}
editor.insert('\n```\n' + text + '\n```\n');
editor.focus();
});
$('#seq-icon').click(function(){
var text = editor.session.getTextRange(editor.selection.getRange()).trim();
if(text.length == 0) {
text = 'sequenceDiagram\nA->>B: How are you?\nB->>A: Great!';
}
editor.insert('\n```\n' + text + '\n```\n');
editor.focus();
});
// modals
$(document).on('close', '.remodal', function(e) {
editor.focus(); // 关闭modal,编辑器自动获得焦点
});
});
Due to the limitation of web pages, it may not easy to export pdf in the front end.
However, here is a work around, use Chrome to open http://mdp.tylingsoft.com/, then open the "Inspect Element" tool, input window.print();
in the console, then we may be able to print the page to pdf with the help of browsers.
My suggestion: add a "print" button in the toolbar in the online version that triggers the window.print();
function, which helps users export the pdf.
:-) Thanks for the good product!
header 1 | header 2 |
---|---|
row 1 col 1 | row 1 col 2 |
row 2 col 1 | row 2 col 2 |
但是在github 或者其他网站 他们只认 下面这种格式 (既两端都有 | ),希望兼容
| Tables | Are | Cool |
|这一行我忽略掉了
| col 3 is | right-aligned | $1600 |
| col 2 is | centered | $12 |
| zebra stripes | are neat | $1|
Math formulas are little bit crazy.
I follow https://meta.wikimedia.org/wiki/Help:Displaying_a_formula
σ => \sigma
and so long..
But how to write & symbol
syntax \And throw error
Also \mathbb{letter} does not work
很多场景需要打开多个文档同时查看,现在好像只能打开一个窗口?
当Markdown中插入很多图片后,Prevew区域的滚动应该按内容同步而不是百分比
什么情况?
Would love the ability to show/hide the toolbar... I find it quite distracting since I know markdown and don't use the toolbar buttons for formatting etc. Any chance we can get an update with the ability to turn it off?
Such as page width, height, margin ... etc.
For example, when user wants to search something, pressing Cmd - f works. But relevant menu item is gray.
Such as:
mdp test.md
@tylingsoft
请问如何部署markdown-plus开发环境?就是能发不成js+css的,浏览器能用就行
建议支持编辑快捷键 如 Ctrl +B = 加粗
编辑器自动插入的表格 在gitosc 和 coding 上都没发正常显示 都变成文字了
Key |Type |Vlaue |Explain ---|--- ID |String |OTA | ACTION |String |ReqInstallPkg |
其他建议
导出pdf 或者image时 Save窗口预设文件名(如:当前编辑的文件叫做 demo.rd 预设的保存文件名则为 demo.pdf)
支持窗口拖入文件用于 open file
增加文件关联(目前右键 然后 用MPlus.exe 打开文件后,mplus是一片白 不能用
settings 界面在全屏情况下 无法操作 (Windows 7 64位 双屏)
Mac app doesn't support HTML export
markdown-plus.js 和 dist/markdown-plus.min.js有什么区别?
依赖关系是怎样的?
也可能是操作不当
一定要放在<boby>
的直接子结点上吗?
貌似放到子节点的子节点上就报错??
UI Layout Initialization Error
The center-pane element does not exist.
The center-pane is a required element
能嵌入到某个div内吗,然后自己搞全屏或非全屏吗?
RT,markdown编辑器windows下面这个很少有做得好的,希望mdp可以做好
不放置任何编辑器,纯粹给客户端浏览器解析markdown文本到html文本,也不能用
然后windows下有个问题,把md设置为用mps打开的时候,出来是一个卡死的untitiled的窗口。
希望能够有快捷方式自动按照h标签生成目录树,另外打听一下下一版本预计什么更新.
谢谢
[TOR]
可以参考一下马克飞象的这个功能It's provided by ACE editor
这是我见过最好最强大的markdown,首先感谢一下你们
另外如果能全屏预览就更好了 非常感谢!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.