markdown 流程图js_标记(Markdown)+美人鱼(流程图)

From what I gather I should be able to write the following in markdown

```

graph TD;A-->B;A-->C;B-->D;C-->D;

```

and have it render

FLOWCHART / DIAGRAM IS DRAWN HERE

What am I missing?

Document

var renderer = new marked.Renderer();

renderer.code = function (code, language) {

if(code.match(/^sequenceDiagram/)||code.match(/^graph/)){

return '

'+code+'
';

}

};

$(document).ready(function(){

$.get( "test.md", function( data ) {

// console.log(data);

$('#content').html(marked(data));

});

});

console.log(marked('```graph TD;A-->B;A-->C;B-->D;C-->D;```', { renderer: renderer }));

解决方案

I tested your code as far as to get the console.log writing the mermaid div.

There is nothing wrong with your marked instantiation and nothing wrong with your renderer. However... the markdown in the console log was not ok.

By adding new lines before and after the graph definition the expeced div was printed to the console.:

\ngraph TD;A-->B;A-->C;B-->D;C-->D;\n

I hope this helps.

/Knut

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值