1
0
mirror of synced 2025-11-06 04:30:40 +08:00

chore(doc): Update CDN example

This commit is contained in:
Jamie Peabody
2023-08-27 11:38:38 +01:00
parent cd09815b7d
commit 2b561c1856
3 changed files with 49 additions and 3 deletions

View File

@@ -36,11 +36,13 @@ rm -rf .git
### Usage via CDN
Unpack mergely.tgz into a folder, for example, `./lib`, and add the following to the `<head>` of your target HTML source file.
Add the following to the `<head>` of your target HTML source file.
```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/mergely/5.0.0/mergely.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mergely/5.0.0/mergely.css"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mergely/5.0.0/mergely.min.js"></script>
<link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/mergely/5.0.0/mergely.css" />
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.12/codemirror.min.js"></script>
<link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.12/codemirror.css" />
```
### Synchronous initialization

41
examples/cdn.html Normal file
View File

@@ -0,0 +1,41 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Mergely - Example full page editor</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="mergely,diff,merge,compare" />
<meta name="author" content="Jamie Peabody" />
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
<!-- Mergely -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mergely/5.0.0/mergely.min.js"></script>
<link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/mergely/5.0.0/mergely.css" />
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.12/codemirror.min.js"></script>
<link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.12/codemirror.css" />
<style type="text/css">
html, body {
height: 100%;
margin: 0;
}
#compare {
height: inherit;
}
</style>
</head>
<body>
<div id="compare"></div>
<script>
const mergely = new Mergely('#compare');
mergely.once('updated', () => {
mergely.lhs('the quick red fox\njumped over the hairy dog');
mergely.rhs('the quick brown fox\njumped over the lazy dog');
});
</script>
</body>
</html>

View File

@@ -21,6 +21,9 @@ This example demonstrates the minimum amount of code required to use Mergely.
<h1>Examples</h1>
<dl>
<dt><a href="cdn.html">cdn.html</a></dt>
<dd>Demonstrates how to use Mergely with CDN.</dd>
<dt><a href="editor.html">editor.html</a></dt>
<dd>An example editor showcasing some of Mergely's API features.</dd>