Ionaru / Ionaru/easy-markdown-editor

Code not highlighting with renderingConfig

Open
#116 2 comments 1 reaction 0 assignees View on GitHub
Question
Dominant language
JavaScript
Stars
3.1k
Forks
363
PR merge metrics
No merged PRs in 30d

Description

**Describe your question**
Code highlighting doesn't seem to be working. The rendered result looks the same with or without the `renderingConfig`. But if I call `hljs.highlightBlock(block)` I get the expected result once, but after toggling preview on and off it will revert back to the unformatted code block.

Is there something else that needs to be set?

I have a jsfiddle https://jsfiddle.net/c65jdpzm/10/ of the following code:
```
$(function() {
var easyMDE = new EasyMDE({
element: $("#editor")[0],
renderingConfig: {
codeSyntaxHighlighting: true
},
initialValue: "```function doSomething() {}```"
});

easyMDE.togglePreview();

document.querySelectorAll('code').forEach((block) => {
// will work once when the next line is uncommented
// hljs.highlightBlock(block);
});
});
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.