Code Monkey home page Code Monkey logo

markdown-plus's People

Contributors

chinakids avatar leozvc avatar songsuoyuan avatar tylerlong avatar vinicius-sabadim avatar xuchunyang avatar xvweirong avatar yuerlee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

markdown-plus's Issues

含有iframe的文档会自动打开浏览器

在md文档中插入iframe代码后,每次用markdown plus打开文件时会自动启动浏览器并显示iframe中的内容,切换回markdown plus继续编辑后,也会不断地跳到浏览器窗口,无法继续正常写作。

Basic mode and extended mode

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

How to hide preview panel ,use javascript?I don't want preview panel is displaying on page load.It's unfriendly to mobile user.

Emacs key binding 支持太差

弱不堪用。
ctrl+n = new file 而不是next line
ctrl+shift+-根本不能撤销
不能打开上次编辑的文档,每次都要重新打开
程序经常假死
值60块?

内容多时有明显卡顿

如题,已在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

考虑加入数学inline公式支持?

目前数学公式似乎只能由

``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加载速度更快!

enhacement: replacing underscore with plain JS

_.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,编辑器自动获得焦点
  });

});

suggesion: add a "print" button in the online version

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!

建议1增加编辑快捷键 2插入表格的问题 其他

  1. 建议支持编辑快捷键 如 Ctrl +B = 加粗
  2. 目前插入的表格为
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|

  1. 其他优化
    - 导出pdf 或者image时 Save窗口预设文件名(如:当前编辑的文件叫做 demo.rd 预设的保存文件名则为 demo.pdf)
    - 支持窗口拖入文件用于 open file
  2. settings 界面在全屏情况下 无法操作 (Windows 7 64位 双屏)

Bought your app today on App Store

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?

建议1增加编辑快捷键 2插入表格的问题 其他

建议支持编辑快捷键 如 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位 双屏)

Complete Symbol Support

  1. Complete Symbol maybe more useful in code typing
  2. Can I change theme in Version 1.3.4 or next version

一定要放置<boby>的直接子结点上吗?

一定要放在<boby>的直接子结点上吗?
貌似放到子节点的子节点上就报错??

UI Layout Initialization Error
The center-pane element does not exist.
The center-pane is a required element

能嵌入到某个div内吗,然后自己搞全屏或非全屏吗?

首先赞一下这个软件

然后windows下有个问题,把md设置为用mps打开的时候,出来是一个卡死的untitiled的窗口。

已经购入 支持作者,一定要勤更新啊~

  • 发现sequence图的支持不是特别好。如果我的sequence很长...就没有办法展示完全。导出PDF的时候发现也是只有一部分。
  • 求SQL语法高亮的效果能明显一点点~
  • 是否可以支持生成目录 [TOR] 可以参考一下马克飞象的这个功能

Best markdown editor

这是我见过最好最强大的markdown,首先感谢一下你们

另外如果能全屏预览就更好了 非常感谢!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.