Problem
I want to create a page with a code editor embedded in it.I looked up codemirror
but i am having problems using it as i am new to java script.
So I am looking for an easy way to embed a code editor into a page(using java script or python).Can someone please provide some link/tutorial or method for it.
Highlight the embed code, then copy it to your clipboard. In your content management system, open up your HTML viewer. Paste the HTML snippet you just copied into your HTML viewer window. Then click 'OK' or 'Save.
Try Ace: https://github.com/ajaxorg/ace (source) https://ace.c9.io/ (Project page), this JavaScript editor is used by Cloud9
I know this is old post , This is how i did while developing online code-editor you can use ace-editor
check this sample from ace
<html lang="en">
<head>
<title>ACE in Action</title>
<style type="text/css" media="screen">
#editor {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
</style>
</head>
<body>
<div id="editor">function foo(items) {
var x = "All this is syntax highlighted";
return x;
}</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.5/ace.js" type="text/javascript" charset="utf-8"></script>
<script>
var editor = ace.edit("editor");
editor.setTheme("ace/theme/monokai");
editor.session.setMode("ace/mode/javascript");
</script>
</body>
</html>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With