.showCode{
width: 100%;
height:100%;
border: 1px solid #ccc;
}
img{
width: 750px;
}
$(function(){
//富文本编辑器配置
simplemde = new SimpleMDE({
autofocus: false,//是否自动对焦
//自定义样式文本块的某些按钮的行为方式
blockStyles: {
bold: "__",
italic: "_"
},
element: document.getElementById("code"),//选择器
indentWithTabs: true,//如果设置为false,则使用空格而不是制表符缩进。默认为true。
insertTexts: {
horizontalRule: ["", "\n\n-----\n\n"],
image: ["![](http://", ")"],
link: ["[", "](http://)"],
table: ["", "\n\n| Column 1 | Column 2 | Column 3 |\n| -------- | -------- | -------- |\n| Text | Text | Text |\n\n"],
},
lineWrapping: false,//如果设置为false,则禁用换行。默认为true。
parsingConfig: {
allowAtxHeaderWithoutSpace: true,
strikethrough: true,
underscoresBreakWords: true,
},
placeholder: "请使用 Markdown 格式书写 ;-),代码块请标语言,示例如下,否则无高亮\n```php\n//代码开始\n```\nOK!开始你的创作吧!",
promptURLs: false,
//快捷键
shortcuts: {
drawTable: "Cmd-Alt-T"
},
showIcons: ["code", "table"],
spellChecker: false,//检查拼音
status: true,
status: ["autosave", "lines", "words", "cursor"], // Optional usage
status: ["autosave", "lines", "words", "cursor", {
className: "keystrokes",
defaultValue: function(el) {
this.keystrokes = 0;
el.innerHTML = "0 Keystrokes";
},
onUpdate: function(el) {
el.innerHTML = ++this.keystrokes + " Keystrokes";
}
}], // Another optional usage, with a custom status bar item that counts keystrokes
styleSelectedText: false,
tabSize: 8,
toolbarTips:true,
});
// $("textarea").keyup(function(){
// var content = simplemde.value();
// var converter = new showdown.Converter();
// markdown_content = converter.makeHtml(content);
// $('.showCode').html(markdown_content);
// });
})
一键复制
编辑
Web IDE
原始数据
按行查看
历史