gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitfefaedd2fefaedd2log: tracker PR-only, HL25 startedmrefefaedd2/components/markdown.hl

6.2 KB

  1. // components/markdown.hl — A MARKDOWN TEXT, RENDERED (as tickets.worldapi.org components/markdown.hl,
  2. // for the repo homepage gitoria#8): `Markdown { blocks = … }` with the blocks of markdown.hl's
  3. // markdownBlocks. The blocks are plain data; every character of the source is a TEXT node here and a
  4. // link's href was checked by markdown.hl safeHref — no HTML string is ever built (no raw HTML, no
  5. // scripts, no `javascript:` links). The page owns h1 (the repo name): a README's `#` is an h2, `##`
  6. // an h3, deeper an h4. The span markup is written out once per block kind: a View has no macros.
  7. blocks = []
  8. View {
  9. markdownText {
  10. for (b of blocks) {
  11. if (b.isP) { p {
  12. for (s of b.spans) {
  13. if (s.isText) { s.text }
  14. if (s.isStrong) { strong { s.text } }
  15. if (s.isEm) { em { s.text } }
  16. if (s.isStrongEm) { strong { em { s.text } } }
  17. if (s.isCode) { code { s.text } }
  18. if (s.isLink) { a { href = s.href rel = "nofollow noopener noreferrer" s.text } }
  19. }
  20. } }
  21. if (b.isH1) { h2 {
  22. for (s of b.spans) {
  23. if (s.isText) { s.text }
  24. if (s.isStrong) { strong { s.text } }
  25. if (s.isEm) { em { s.text } }
  26. if (s.isStrongEm) { strong { em { s.text } } }
  27. if (s.isCode) { code { s.text } }
  28. if (s.isLink) { a { href = s.href rel = "nofollow noopener noreferrer" s.text } }
  29. }
  30. } }
  31. if (b.isH2) { h3 {
  32. for (s of b.spans) {
  33. if (s.isText) { s.text }
  34. if (s.isStrong) { strong { s.text } }
  35. if (s.isEm) { em { s.text } }
  36. if (s.isStrongEm) { strong { em { s.text } } }
  37. if (s.isCode) { code { s.text } }
  38. if (s.isLink) { a { href = s.href rel = "nofollow noopener noreferrer" s.text } }
  39. }
  40. } }
  41. if (b.isH3) { h4 {
  42. for (s of b.spans) {
  43. if (s.isText) { s.text }
  44. if (s.isStrong) { strong { s.text } }
  45. if (s.isEm) { em { s.text } }
  46. if (s.isStrongEm) { strong { em { s.text } } }
  47. if (s.isCode) { code { s.text } }
  48. if (s.isLink) { a { href = s.href rel = "nofollow noopener noreferrer" s.text } }
  49. }
  50. } }
  51. if (b.isQuote) { blockquote {
  52. for (s of b.spans) {
  53. if (s.isText) { s.text }
  54. if (s.isStrong) { strong { s.text } }
  55. if (s.isEm) { em { s.text } }
  56. if (s.isStrongEm) { strong { em { s.text } } }
  57. if (s.isCode) { code { s.text } }
  58. if (s.isLink) { a { href = s.href rel = "nofollow noopener noreferrer" s.text } }
  59. }
  60. } }
  61. if (b.isUl) { ul {
  62. for (it of b.items) { li {
  63. for (s of it.spans) {
  64. if (s.isText) { s.text }
  65. if (s.isStrong) { strong { s.text } }
  66. if (s.isEm) { em { s.text } }
  67. if (s.isStrongEm) { strong { em { s.text } } }
  68. if (s.isCode) { code { s.text } }
  69. if (s.isLink) { a { href = s.href rel = "nofollow noopener noreferrer" s.text } }
  70. }
  71. } }
  72. } }
  73. if (b.isOl) { ol { start = b.start
  74. for (it of b.items) { li {
  75. for (s of it.spans) {
  76. if (s.isText) { s.text }
  77. if (s.isStrong) { strong { s.text } }
  78. if (s.isEm) { em { s.text } }
  79. if (s.isStrongEm) { strong { em { s.text } } }
  80. if (s.isCode) { code { s.text } }
  81. if (s.isLink) { a { href = s.href rel = "nofollow noopener noreferrer" s.text } }
  82. }
  83. } }
  84. } }
  85. if (b.isCode) { pre { code { b.code } } }
  86. if (b.isHr) { hr { } }
  87. if (b.isTable) { tableScroll { table {
  88. thead { tr {
  89. for (c of b.head) { th {
  90. for (s of c.spans) {
  91. if (s.isText) { s.text }
  92. if (s.isStrong) { strong { s.text } }
  93. if (s.isEm) { em { s.text } }
  94. if (s.isStrongEm) { strong { em { s.text } } }
  95. if (s.isCode) { code { s.text } }
  96. if (s.isLink) { a { href = s.href rel = "nofollow noopener noreferrer" s.text } }
  97. }
  98. } }
  99. } }
  100. tbody {
  101. for (r of b.rows) { tr {
  102. for (c of r) { td {
  103. for (s of c.spans) {
  104. if (s.isText) { s.text }
  105. if (s.isStrong) { strong { s.text } }
  106. if (s.isEm) { em { s.text } }
  107. if (s.isStrongEm) { strong { em { s.text } } }
  108. if (s.isCode) { code { s.text } }
  109. if (s.isLink) { a { href = s.href rel = "nofollow noopener noreferrer" s.text } }
  110. }
  111. } }
  112. } }
  113. }
  114. } } }
  115. }
  116. }
  117. }
  118. Style {
  119. markdownText {
  120. display = 'block'
  121. minWidth = '0'
  122. // Direct-child and sibling combinators have no bare language form.
  123. '> :first-child' {
  124. marginTop = '0'
  125. }
  126. // Direct-child and sibling combinators have no bare language form.
  127. '> :last-child' {
  128. marginBottom = '0'
  129. }
  130. p {
  131. margin = '.5rem 0'
  132. overflowWrap = 'anywhere'
  133. }
  134. li {
  135. margin = '.15rem 0'
  136. overflowWrap = 'anywhere'
  137. }
  138. h2 {
  139. margin = '1.2rem 0 .5rem'
  140. lineHeight = '1.3'
  141. color = 'var(--color-text-strong)'
  142. fontSize = '1.25rem'
  143. }
  144. h3 {
  145. margin = '1.2rem 0 .5rem'
  146. lineHeight = '1.3'
  147. color = 'var(--color-text-strong)'
  148. fontSize = '1.08rem'
  149. }
  150. h4 {
  151. margin = '1.2rem 0 .5rem'
  152. lineHeight = '1.3'
  153. color = 'var(--color-text-strong)'
  154. fontSize = '1rem'
  155. }
  156. ul {
  157. margin = '.5rem 0'
  158. paddingLeft = '1.4rem'
  159. listStyleType = 'disc'
  160. }
  161. ol {
  162. margin = '.5rem 0'
  163. paddingLeft = '1.4rem'
  164. listStyleType = 'decimal'
  165. }
  166. strong {
  167. color = 'var(--color-text-strong)'
  168. }
  169. a {
  170. color = 'var(--color-accent)'
  171. textDecoration = 'underline'
  172. textUnderlineOffset = '.15em'
  173. }
  174. code {
  175. font = 'max(.875rem, .9em)/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace'
  176. padding = '.05em .3em'
  177. color = 'var(--color-text-strong)'
  178. background = 'var(--color-background-sunken)'
  179. borderRadius = 'var(--radius-small)'
  180. }
  181. pre {
  182. margin = '.5rem 0'
  183. padding = '.6rem .8rem'
  184. overflowX = 'auto'
  185. background = 'var(--color-background-sunken)'
  186. borderRadius = 'var(--radius-large)'
  187. code {
  188. padding = '0'
  189. background = 'transparent'
  190. whiteSpace = 'pre'
  191. }
  192. }
  193. blockquote {
  194. margin = '.5rem 0'
  195. padding = '.1rem .9rem'
  196. color = 'var(--color-text-muted)'
  197. borderLeft = '3px solid ' + 'var(--color-surface)' // functional: the bar identifies a quotation.
  198. }
  199. hr {
  200. height = '1px'
  201. margin = '1rem 0'
  202. border = '0'
  203. background = 'var(--color-surface)'
  204. }
  205. tableScroll {
  206. display = 'block'
  207. maxWidth = '100%'
  208. overflowX = 'auto'
  209. margin = '.5rem 0'
  210. contain = 'inline-size'
  211. }
  212. table {
  213. width = 'auto'
  214. margin = '0'
  215. }
  216. th {
  217. fontSize = '.875rem'
  218. }
  219. }
  220. }

Branches

Latest commits

  • fefaedd2log: tracker PR-only, HL25 startedmre
  • 21aa57calog: parkmre
  • e9f950a8reports: G25c soakmre
  • a7783686log: deploy 9f41ffcmre
  • 9f41ffc1log: W30b mergedmre
  • bef635c1Merge branch 'w30b'mre
  • 15b996a5Org list: keyed rows by @id, newest first, concat instead of hand loopmre
  • c4f6d9e3reports: G25c growth huntmre
  • b88e39f1log: privacy cleanup donemre
  • bfd7826ddocs: neutral example organisation namemre
  • 01b71c2edocs: neutral wording in missions, reports and logmre
  • 3eeea733log: 2026-11-09 PR flow plan and membersmre
  • e7c2ff1fdocs: neutral name for the apps-api reviewmre
  • 120b7abdlog: step 3 queuedmre
  • 358474bflog: P50 livemre
  • 477d7bdcMerge branch 'p50'mre
  • 00efc06fP50 reportmre
  • e3f85afblog: commit mention slipmre
  • 4d1a4cf4log: #25 numbersmre
  • 1af0a60ddocs: H25 run() correctionmre