Specify width and syntax highlighting and indentation

This commit is contained in:
2023-01-29 23:26:48 -06:00
parent 7e969f1469
commit 78d8457f75
5 changed files with 147 additions and 14 deletions
+2 -1
View File
@@ -6,7 +6,8 @@ import init, { WasmCPU, assemble_snippet } from '../pkg/vweb.js'
document.addEventListener('DOMContentLoaded', () => {
init().then(() => {
document.querySelectorAll('.snippet').forEach((el) => {
createRoot(el).render(React.createElement(SnippetEmulator, { children: el.innerText }))
const props = { children: el.innerText, width: el.getAttribute('data-width') }
createRoot(el).render(React.createElement(SnippetEmulator, props))
})
})
})