Open walterdavis opened 10 years ago
I've tested this with the default HTML given in the README as well (without Prorotype.js), in three current browsers: Chrome, Safari, and Firefox (all latest public versions). All three throw the same two errors and refuse to do anything else.
I ran into same error using v0.6.0-beta1. I avoid error by the following html.
<!DOCTYPE html>
<html>
<body>
<textarea id="text-input" oninput="this.editor.update()"
rows="6" cols="60">Type **Markdown** here.</textarea>
<div id="preview"> </div>
<script>var exports = this;</script><!-- ADD HERE -->
<script src="lib/markdown.js"></script>
<script>
function Editor(input, preview) {
this.update = function () {
var markdown = Markdown; // ADD HERE
preview.innerHTML = markdown.toHTML(input.value);
};
input.editor = this;
this.update();
}
var $ = function (id) { return document.getElementById(id); };
new Editor($("text-input"), $("preview"));
</script>
</body>
</html>
It works on Firefox(ver 30.0). I don't think this is good solution, but anyway it works.
Oh, I'm wrong.
I downloaded "markdown-0.6.0-beta1.tar.gz". But It needs "markdown-browser-0.6.0-beta1.tar.gz" for using on the browser.
It works fine with following html in the "markdown-browser-0.6.0-beta1" directory.
<!DOCTYPE html>
<html>
<body>
<textarea id="text-input" oninput="this.editor.update()"
rows="6" cols="60">Type **Markdown** here.</textarea>
<div id="preview"> </div>
<script src="markdown.js"></script><!-- CHANGE PATH -->
<script>
function Editor(input, preview) {
this.update = function () {
preview.innerHTML = markdown.toHTML(input.value);
};
input.editor = this;
this.update();
}
var $ = function (id) { return document.getElementById(id); };
new Editor($("text-input"), $("preview"));
</script>
</body>
</html>
Here's the entire index.html: