evilstreak / markdown-js

A Markdown parser for javascript
7.69k stars 863 forks source link

前端直接使用支持不友好 #105

Closed Dn9x closed 10 years ago

Dn9x commented 10 years ago
<!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="lib/markdown.js"></script>
    <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>

this is you example! if input code,No effect!

evilstreak commented 10 years ago

Is it able to load the markdown.js file? I.e. have you made this HTML file in the root of the cloned repo, or copied markdown.js to be in the correct place relative to your HTML file?