Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

调用 setMarkdown() 方法之后,代码没有语法高亮 #24

Closed
tylerlong opened this issue Mar 2, 2015 · 5 comments
Closed

调用 setMarkdown() 方法之后,代码没有语法高亮 #24

tylerlong opened this issue Mar 2, 2015 · 5 comments

Comments

@tylerlong
Copy link
Contributor

Chrome 浏览器访问 https://pandao.github.io/editor.md/examples/full.html

打开console, 执行: testEditor.setMarkdown("\tfunction test() {\n\t\talert('test');\n\t}");

HTML实时预览那里,代码没有语法高亮。

随便敲个回车空格之类的,触发onChange事件, 就有语法高亮了。

@pandao
Copy link
Owner

pandao commented Mar 2, 2015

我这边试了可以呀

@tylerlong
Copy link
Contributor Author

Mac OS X 10.10, Google Chrome Version 40.0.2214.115 (64-bit)

Win8 + Chrome 也测了,也不行

image

有高亮的应该是这样:

image

@pandao
Copy link
Owner

pandao commented Mar 2, 2015

嗯,试了一下,我这边Win7 + Chrome 39也不行,Change时没有及时加上代码高亮的样式类class="prettyprint linenums prettyprinted"。先标记一下,稍后一并修复。

@pandao
Copy link
Owner

pandao commented Mar 2, 2015

@v1.1.6 fixed.

@pandao pandao closed this as completed Mar 2, 2015
@thinkycx
Copy link

thinkycx commented May 4, 2017

  • 请问调用setMarkdown如何传入多行参数呢?
    temp 中只要出现转义字符\r\n前端就会渲染失败。
    请问是需要设置别的东西吗?
    <script type="text/javascript">
        var temp = "{{ content }}";
        document.write(temp);
        $(function () {
            var testEditor = editormd("editormd", {
                width: "100%",
                height: 640,
                syncScrolling: "single",
                saveHTMLToTextarea: true,
                path: "{{url_for('static', filename='editor.md/lib/')}}",
                htmlDecode : true ,
                onload: function(){
                // alert("onload");
                this.setMarkdown(temp);
                // console.log("onload =>", this, this.id, this.settings);
                 }
            });
        });
    </script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants