mirror of
https://github.com/wickedest/Mergely.git
synced 2026-02-26 11:07:56 +08:00
50 lines
1.5 KiB
HTML
50 lines
1.5 KiB
HTML
<!--
|
|
This example demonstrates the minimum amount of code required to use Mergely.
|
|
-->
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8" /><title>Mergely - Simple Example</title>
|
|
<meta http-equiv="X-UA-Compatible" content="chrome=1, IE=edge">
|
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
|
|
<meta name="description" content="" />
|
|
<meta name="keywords" content="" />
|
|
<meta name="author" content="Jamie Peabody" />
|
|
|
|
<!-- CodeMirror peer dependency -->
|
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.0/codemirror.min.js"></script>
|
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.0/addon/search/searchcursor.min.js"></script>
|
|
<link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.0/codemirror.min.css" />
|
|
|
|
<!-- Mergely -->
|
|
<script type="text/javascript" src="/lib/mergely.js"></script>
|
|
<link type="text/css" rel="stylesheet" href="/lib/mergely.css" />
|
|
|
|
<style type="text/css">
|
|
html, body {
|
|
height: 100%;
|
|
margin: 0;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="mergely"></div>
|
|
|
|
<script type="text/javascript">
|
|
document.onreadystatechange = function () {
|
|
if (document.readyState !== 'complete') {
|
|
return;
|
|
}
|
|
const doc = new Mergely('#mergely');
|
|
|
|
fetch('/examples/macbeth.txt')
|
|
.then((resp) => resp.text())
|
|
.then(data => {
|
|
doc.lhs(data);
|
|
doc.rhs(data)
|
|
});
|
|
};
|
|
</script>
|
|
</body>
|
|
</html>
|