leeoniya / reMarked.js

client-side HTML > markdown
http://leeoniya.github.io/reMarked.js/
396 stars 97 forks source link

Has no method 'rend' #20

Closed hadees closed 11 years ago

hadees commented 11 years ago

So I have the following html generated by wysihtml5

<div class="html-directions">
  1. &nbsp;Quisque id justo sit amet sapien dignissim vestibulum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nulla dapibus dolor vel est. Donec odio justo, sollicitudin ut, suscipit a, feugiat et, eros.
<br>
<br>
  2. &nbsp;Etiam vel augue. Vestibulum rutrum rutrum neque. Aenean auctor gravida sem.
</div>

and when I try to render it I get the following error

Uncaught TypeError: Object function () {
    return this.sort(function() {
      return 0.5 - Math.random();
    });
  } has no method 'rend' 

from reMarked.js on line 196

leeoniya commented 11 years ago

work okay here like this...

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>reMarked issue #20 test</title>

    <script src="reMarked.js"></script>
    <script>
        window.onload = function() {
            var reMarker = new reMarked();

            var markdown = reMarker.render(document.body);
            console.log(markdown);
        };
    </script>
</head>
<body>
<div class="html-directions">
  1. &nbsp;Quisque id justo sit amet sapien dignissim vestibulum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nulla dapibus dolor vel est. Donec odio justo, sollicitudin ut, suscipit a, feugiat et, eros.
<br>
<br>
  2. &nbsp;Etiam vel augue. Vestibulum rutrum rutrum neque. Aenean auctor gravida sem.
</div>
</body>
</html>
leeoniya commented 11 years ago

this also works...

var html = "<div class=\"html-directions\">\n  1. &nbsp;Quisque id justo sit amet sapien dignissim vestibulum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nulla dapibus dolor vel est. Donec odio justo, sollicitudin ut, suscipit a, feugiat et, eros.\n<br>\n<br>\n  2. &nbsp;Etiam vel augue. Vestibulum rutrum rutrum neque. Aenean auctor gravida sem.\n</div>";
var markdown2 = reMarker.render(html);
console.log(markdown2);

tested in FF nightly and Chrome

leeoniya commented 11 years ago

i'm closing this until there's a reproducible testcase. please put something up on jsFiddle which shows the issue. thanks!