index.html 904 B

12345678910111213141516171819202122232425
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
  5. <script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
  6. <script type='module' src='index.mjs'> </script>
  7. </head>
  8. <body>
  9. <textarea id='md' style='height: 700px; width: 100%;'>
  10. </textarea>
  11. <button id='update'>update</button>
  12. <div id='reactMD'>
  13. </div>
  14. <script type='module'>
  15. import {buildAST, toReact} from './index.mjs'
  16. md.value = localStorage.md || '# markdown here\n'
  17. md.oninput = () => {
  18. localStorage.md = md.value
  19. const ast = buildAST(md.value)
  20. console.log(ast)
  21. ReactDOM.render(toReact(ast, React), reactMD)
  22. }
  23. </script>
  24. </body>
  25. </html>