Skip to content

Instantly share code, notes, and snippets.

@Soontao
Created June 27, 2019 07:16
Show Gist options
  • Save Soontao/c74c6680ac4af9df03c0ec5e6f2531ab to your computer and use it in GitHub Desktop.
Save Soontao/c74c6680ac4af9df03c0ec5e6f2531ab to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Monaco Demo</title>
<script src="https://cdn.bootcss.com/require.js/2.3.6/require.min.js"></script>
</head>
<body>
<div id="container" style="width:800px;height:600px;border:1px solid #ccc"></div>
<script>
require.config({ paths: { 'vs': 'https://cdn.bootcss.com/monaco-editor/0.17.0/min/vs' } });
require(['vs/editor/editor.main'], function () {
var editor = monaco.editor.create(document.getElementById('container'), {
value: [
'function x() {',
'\tconsole.log("Hello world!");',
'}'
].join('\n'),
language: 'javascript'
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment