12345678910111213141516171819202122232425 |
- <!DOCTYPE HTML>
- <html>
- <head>
- <script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
- <script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
- <script type='module' src='index.mjs'> </script>
- </head>
- <body>
- <textarea id='md' style='height: 700px; width: 100%;'>
- </textarea>
- <button id='update'>update</button>
- <div id='reactMD'>
- </div>
- <script type='module'>
- import {buildAST, toReact} from './index.mjs'
- md.value = localStorage.md || '# markdown here\n'
- md.oninput = () => {
- localStorage.md = md.value
- const ast = buildAST(md.value)
- console.log(ast)
- ReactDOM.render(toReact(ast, React), reactMD)
- }
- </script>
- </body>
- </html>
|