gitoria
All repositories: gitoria
4.0 KB
// components/markdown.hl — A MARKDOWN TEXT, RENDERED (as tickets.worldapi.org components/markdown.hl,// for the repo homepage gitoria#8): `Markdown { blocks = … }` with the blocks of markdown.hl's// markdownBlocks. The blocks are plain data; every character of the source is a TEXT node here and a// link's href was checked by markdown.hl safeHref — no HTML string is ever built (no raw HTML, no// scripts, no `javascript:` links). The page owns h1 (the repo name): a README's `#` is an h2, `##`// an h3, deeper an h4. The span markup is written out once per block kind: a View has no macros.blocks = []View {markdownText {for (b of blocks) {if (b.isP) { p {for (s of b.spans) {if (s.isText) { s.text }if (s.isStrong) { strong { s.text } }if (s.isEm) { em { s.text } }if (s.isStrongEm) { strong { em { s.text } } }if (s.isCode) { code { s.text } }if (s.isLink) { a { href = s.href rel = "nofollow noopener noreferrer" s.text } }}} }if (b.isH1) { h2 {for (s of b.spans) {if (s.isText) { s.text }if (s.isStrong) { strong { s.text } }if (s.isEm) { em { s.text } }if (s.isStrongEm) { strong { em { s.text } } }if (s.isCode) { code { s.text } }if (s.isLink) { a { href = s.href rel = "nofollow noopener noreferrer" s.text } }}} }if (b.isH2) { h3 {for (s of b.spans) {if (s.isText) { s.text }if (s.isStrong) { strong { s.text } }if (s.isEm) { em { s.text } }if (s.isStrongEm) { strong { em { s.text } } }if (s.isCode) { code { s.text } }if (s.isLink) { a { href = s.href rel = "nofollow noopener noreferrer" s.text } }}} }if (b.isH3) { h4 {for (s of b.spans) {if (s.isText) { s.text }if (s.isStrong) { strong { s.text } }if (s.isEm) { em { s.text } }if (s.isStrongEm) { strong { em { s.text } } }if (s.isCode) { code { s.text } }if (s.isLink) { a { href = s.href rel = "nofollow noopener noreferrer" s.text } }}} }if (b.isQuote) { blockquote {for (s of b.spans) {if (s.isText) { s.text }if (s.isStrong) { strong { s.text } }if (s.isEm) { em { s.text } }if (s.isStrongEm) { strong { em { s.text } } }if (s.isCode) { code { s.text } }if (s.isLink) { a { href = s.href rel = "nofollow noopener noreferrer" s.text } }}} }if (b.isUl) { ul {for (it of b.items) { li {for (s of it.spans) {if (s.isText) { s.text }if (s.isStrong) { strong { s.text } }if (s.isEm) { em { s.text } }if (s.isStrongEm) { strong { em { s.text } } }if (s.isCode) { code { s.text } }if (s.isLink) { a { href = s.href rel = "nofollow noopener noreferrer" s.text } }}} }} }if (b.isOl) { ol { start = b.startfor (it of b.items) { li {for (s of it.spans) {if (s.isText) { s.text }if (s.isStrong) { strong { s.text } }if (s.isEm) { em { s.text } }if (s.isStrongEm) { strong { em { s.text } } }if (s.isCode) { code { s.text } }if (s.isLink) { a { href = s.href rel = "nofollow noopener noreferrer" s.text } }}} }} }if (b.isCode) { pre { code { b.code } } }if (b.isHr) { hr { } }if (b.isTable) { tableScroll { table {thead { tr {for (c of b.head) { th {for (s of c.spans) {if (s.isText) { s.text }if (s.isStrong) { strong { s.text } }if (s.isEm) { em { s.text } }if (s.isStrongEm) { strong { em { s.text } } }if (s.isCode) { code { s.text } }if (s.isLink) { a { href = s.href rel = "nofollow noopener noreferrer" s.text } }}} }} }tbody {for (r of b.rows) { tr {for (c of r) { td {for (s of c.spans) {if (s.isText) { s.text }if (s.isStrong) { strong { s.text } }if (s.isEm) { em { s.text } }if (s.isStrongEm) { strong { em { s.text } } }if (s.isCode) { code { s.text } }if (s.isLink) { a { href = s.href rel = "nofollow noopener noreferrer" s.text } }}} }} }}} } }}}}
Branches
- mainmain branch