-
Hi there, Title pretty self explanatory, I tried to search the doc, online and the Q&A, maybe I'm not searching the the right keywords. Here is a https://jsfiddle.net/yubd24to/, experienced users might quickly find what's missing. Thanks for your help EDIT: Fixed link |
Beta Was this translation helpful? Give feedback.
Answered by
nightwing
Sep 8, 2022
Replies: 1 comment 1 reply
-
This works https://jsfiddle.net/eLdoa5fg/ <script src=https://cdnjs.cloudflare.com/ajax/libs/ace/1.10.1/ace.js></script>
<script src=https://cdnjs.cloudflare.com/ajax/libs/ace/1.10.1/ext-static_highlight.js></script>
<pre class="code" ace-mode="json" ace-theme="monokai" ace-gutter="true">{
"menu": {
"id": "file",
"value": "File",
"popup": {
"menuitem": [
{
"value": "New",
"onclick": "CreateNewDoc()"
},
{
"value": "Open",
"onclick": "OpenDoc()"
},
{
"value": "Close",
"onclick": "CloseDoc()"
}
]
}
}
}</pre> ace.config.set('basePath', 'https://cdnjs.cloudflare.com/ajax/libs/ace/1.10.1');
let highlight = ace.require('ace/ext/static_highlight');
Array.from(document.getElementsByClassName('code')).forEach(el => {
highlight(el, {
mode: 'ace/mode/json',
theme: 'ace/theme/monokai',
firstLineNumber: 1,
showGutter: true,
});
}); |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Max13
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This works https://jsfiddle.net/eLdoa5fg/