/** * @typedef {object} Card - Basic unit of information, also an "actor" in the programming system * @property {number} id Unique identifier * @property {Record} fields Key-value properties on the card * @property {string} code Eventually: a markdown string containing code, but for now, just code */ /** * Global state: a single card * @type {Card} */ let theCard = { id: 100, fields: {}, code: ` h1 Hello, World! para [2 + 2] block { This is a paragraph of text, with one [b bold] word. Yes, this means there has to be some magic in text processing... } block -red "Beware!" para "All text should be quoted, it's clearer that way. & blockquotes already should contain paragraphs. (maybe normalize nested paragraphs)" block { First block } { Second block Is this markdown-parsed? [button "No we want to render UI" {noop}] } { Since we want escapes to work, these blocks [i will] be subject to substitutions. } `, }; const state = document.createElement("pre"); const display = document.createElement("blockquote"); function render() { state.textContent = JSON.stringify(theCard, null, 2); display.innerHTML = "Rendering not implemented"; } render(); document.body.append(state, display);