···11+## Theme variable names:
22+33+- prefixed with “--T-”
44+- words are separated by hyphens
55+- “color” and “background[-color]” are abbreviated to “col” and “bg”
66+- should generally be structured like “--T-❬thing❭-❬property❭”
77+ - ex: “--T-link-col”, “--T-font-size”, “--T-quote-border-radius”, etc.
88+99+1010+## Default theme
1111+1212+I've tried to choose colors that work with dark and light themes
1313+(assuming you set `col` and `bg`)
1414+1515+If any new theme variables are added, their default values will always either:
1616+1717+- work on both light and dark backgrounds
1818+ - ex: `--T-box-bg: #AAA2;` (`#AAA2` is `rgba(170, 170, 170, 0.133)`)
1919+2020+- be defined based on existing properties
2121+ - ex: `--T-icode-col: var(--T-col);`
2222+2323+so existing themes won't need to be updated.
+5-36
markup.css
···11-L + ratio {
22-33-}
11+L + ratio {}
4253.Markup, .Markup * {
64 white-space: pre-wrap;
75 word-break: break-word; /* ⚠ very important to prevent overflow ⚠ */
86}
971010-/*******************/
1111-/** DEFAULT THEME **/
1212-/*******************/
88+/**************************
99+ ** Theme Variables **
1010+ ** (see doc/themes.txt) **
1111+ **************************/
13121414-/*
1515-***********
1616-** DRAFT **
1717-***********
1818-1919-## Theme variable names
2020-2121-- prefixed with “--T-”
2222-- words are separated by hyphens
2323-- “color” and “background[-color]” are abbreviated to “col” and “bg”
2424-- should generally be structured like “--T-❬thing❭-❬property❭”
2525- - ex: “--T-link-col”, “--T-font-size”, “--T-quote-border-radius”, etc.
2626-2727-## Default values
2828-2929-I've tried to choose colors that work with dark and light themes
3030-(assuming you set `col` and `bg`)
3131-3232-If any new theme variables are added, their default values will always either:
3333-3434-- work on both light and dark backgrounds
3535- - ex: `--T-box-bg: #AAA2;` (`#AAA2` is `rgba(170, 170, 170, 0.133)`)
3636-3737-- be defined based on existing properties
3838- - ex: `--T-icode-col: var(--T-col);`
3939-4040-so existing themes won't need to be updated.
4141-*/
4213*:not(*>*) { /* this selects :root with 0 specificity */
4343- /*.Markup:not([data-theme] *)*/
4414 /* normal colors */
4545-4615 --T-col: black;
4716 --T-bg: white;
4817
+10-33
render.js
···22 @typedef {(Element|DocumentFragment|Document)} ParentNode
33*/
4455-//todo: i really don't like the whole getrootnode thing.
66-// maybe should pass the parent to the CREATE function and
77-// have it handle appending, then return the new branch node.
88-// return parent=>parent.appendChild(elem.cloneNode(true))
99-// and then you call this(parent)
1010-// however, then the node gets appended immediately, before it's initialized...
1111-// so really the function process should be
1212-// func(parent, args) {
1313-// let e = template()
1414-// ...
1515-// parent.appendChild(e)
1616-// return e.firstChild
1717-// }
1818-// also: is it more efficient if the templates are in the current document? or somehow cloned INTO it rather than cloned and then adopted...
1919-// yes! importNode
2020-215/**
226 AST -> HTML DOM Node renderer
237*/
···3721 // todo: this needs to be more powerful. i.e. returning entire elements in some cases etc. gosh idk.. need to handle like, sbs emotes ? how uh nno that should be the parser's job.. oh and also this should, like,
3822 // for embeds, need separate handlers for normal urls and embeds and
3923 let URL_SCHEME = {
4040- "sbs:"(url, thing) {
4141- return "#"+url.pathname+url.search+url.hash
4242- },
4343- "https:"(url, thing) { return url.href },
4444- "http:"(url, thing) { return url.href },
4545- "javascript:"(url, thing) { return "about:blank#.no" },
4646- DEFAULT(url, thing) { return "about:blank#"+url.href },
2424+ "sbs:": (url, thing)=> "#"+url.pathname+url.search+url.hash,
2525+ "https:": (url, thing)=> url.href,
2626+ "http:": (url, thing)=> url.href,
2727+ DEFAULT: (url, thing)=> "about:blank#"+url.href,
4728 // these take a url string instead of URL
4848- RELATIVE(href, thing) {
4949- return href.replace(/^[/]{0,2}/, "https://")
5050- },
5151- ERROR(href, thing) { return "about:blank#"+url.href },
2929+ RELATIVE: (url, thing)=> href.replace(/^[/]{0,2}/, "https://"),
3030+ ERROR: (url, thing)=> "about:blank#"+url.href,
5231 }
53325433 function filter_url(url, thing) {
5555- let ret = "about:blank"
5634 try {
5735 let u = new URL(url, "no-scheme:/")
5836 if (u.protocol=='no-scheme:')
5959- ret = URL_SCHEME.RELATIVE(url, thing)
3737+ return URL_SCHEME.RELATIVE(url, thing)
6038 else
6161- ret = (URL_SCHEME[u.protocol] || URL_SCHEME.DEFAULT)(u, thing)
3939+ return (URL_SCHEME[u.protocol] || URL_SCHEME.DEFAULT)(u, thing)
6240 } catch(e) {
6363- ret = URL_SCHEME.ERROR(url, thing)
6464- } finally {
6565- return ret
4141+ return URL_SCHEME.ERROR(url, thing)
6642 }
6743 }
6844···193169 }.bind([𐀶`<td>`,𐀶`<th>`]),
194170195171 youtube: function({url}) {
172172+ // todo: do we filter the url here or?
196173 let e = this()
197174 e.firstChild.textContent = url
198175 e.firstChild.href = url