redbug312 / markdown-it-multimd-table

Multimarkdown table syntax plugin for markdown-it markdown parser
MIT License
146 stars 37 forks source link

Uncaught TypeError: Cannot read properties of undefined (reading 'utils') got when call from html #62

Closed panxw closed 1 year ago

panxw commented 1 year ago

when call from html, got

Uncaught TypeError: Cannot read properties of undefined (reading 'utils')
    at markdown-it-multimd-table.min.js:2:2805
    at onload (simple.html:16:21)
    at onload (simple.html:11:25)

html code:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <script src="https://cdnjs.cloudflare.com/ajax/libs/markdown-it/13.0.1/markdown-it.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/markdown-it-multimd-table@4.2.2/dist/markdown-it-multimd-table.min.js" type="text/javascript"></script>
  <style>
    tr, td ,th {border:1px solid black}
  </style>
</head>
<body onload="onload()">
  <div id="app"></div>
  <script>
    function onload(){
        console.log('onload')
          var md = window.markdownit().use(markdownItMultimdTable, {
              multiline:  true,
              rowspan:    true,
              headerless: false,
              multibody:  true,
              aotolabel:  true,
            });

        const exampleTable =
        "|                       Grouping           ||| \n" +
        "|First Header  | Second Header | Third Header | \n" +
        "|------------ | :-----------: | -----------: | \n" +
        "|Content       |          *Long Cell*        || \n" +
        "|^^|   **Cell**    |         Cell | \n" +
        "                                               \n" +
        "|New section   |     More      |         Data | \n" +
        "|And more      | With an escaped '\\|'       || \n";
            var result = md.render(exampleTable);
            console.log(result)
            document.getElementById("app").innerHTML = result
    }
  </script>
</body>
</html>
redbug312 commented 1 year ago

I misconfigured the minified plugin name, and this leads to a conflict. Please check out version 4.2.3 and set the plugin name as markdownitMultimdTable.

panxw commented 1 year ago

@redbug312 great, It works fine on version 4.2.3, Thanks!