gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit802f229a802f229alog: kunibert repo ping provenmre802f229a/components/markdown.hl

6.0 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. '> :first-child' {
  123. marginTop = '0'
  124. }
  125. '> :last-child' {
  126. marginBottom = '0'
  127. }
  128. p {
  129. margin = '.5rem 0'
  130. overflowWrap = 'anywhere'
  131. }
  132. li {
  133. margin = '.15rem 0'
  134. overflowWrap = 'anywhere'
  135. }
  136. h2 {
  137. margin = '1.2rem 0 .5rem'
  138. lineHeight = '1.3'
  139. color = 'var(--color-text-strong)'
  140. fontSize = '1.25rem'
  141. }
  142. h3 {
  143. margin = '1.2rem 0 .5rem'
  144. lineHeight = '1.3'
  145. color = 'var(--color-text-strong)'
  146. fontSize = '1.08rem'
  147. }
  148. h4 {
  149. margin = '1.2rem 0 .5rem'
  150. lineHeight = '1.3'
  151. color = 'var(--color-text-strong)'
  152. fontSize = '1rem'
  153. }
  154. ul {
  155. margin = '.5rem 0'
  156. paddingLeft = '1.4rem'
  157. listStyleType = 'disc'
  158. }
  159. ol {
  160. margin = '.5rem 0'
  161. paddingLeft = '1.4rem'
  162. listStyleType = 'decimal'
  163. }
  164. strong {
  165. color = 'var(--color-text-strong)'
  166. }
  167. a {
  168. color = 'var(--color-accent)'
  169. textDecoration = 'underline'
  170. textUnderlineOffset = '.15em'
  171. }
  172. code {
  173. font = 'max(.875rem, .9em)/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace'
  174. padding = '.05em .3em'
  175. color = 'var(--color-text-strong)'
  176. background = 'var(--color-background-sunken)'
  177. borderRadius = 'var(--radius-small)'
  178. }
  179. pre {
  180. margin = '.5rem 0'
  181. padding = '.6rem .8rem'
  182. overflowX = 'auto'
  183. background = 'var(--color-background-sunken)'
  184. borderRadius = 'var(--radius-large)'
  185. code {
  186. padding = '0'
  187. background = 'transparent'
  188. whiteSpace = 'pre'
  189. }
  190. }
  191. blockquote {
  192. margin = '.5rem 0'
  193. padding = '.1rem .9rem'
  194. color = 'var(--color-text-muted)'
  195. borderLeft = '3px solid ' + 'var(--color-surface)' // functional: the bar identifies a quotation.
  196. }
  197. hr {
  198. height = '1px'
  199. margin = '1rem 0'
  200. border = '0'
  201. background = 'var(--color-surface)'
  202. }
  203. tableScroll {
  204. display = 'block'
  205. maxWidth = '100%'
  206. overflowX = 'auto'
  207. margin = '.5rem 0'
  208. contain = 'inline-size'
  209. }
  210. table {
  211. width = 'auto'
  212. margin = '0'
  213. }
  214. th {
  215. fontSize = '.875rem'
  216. }
  217. }
  218. }

Branches

Latest commits

  • 802f229alog: kunibert repo ping provenmre
  • 2d2eaa92log: Kunibert connected to kunibert repomre
  • 65d5f80alogmre
  • dab74b0dW49 report, logmre
  • fd4fc028Exercise member status reads with a populated check statemre
  • 536ca6f9Allow repository members to read pull workflow APIs with user tokensmre
  • 705dd834W49 missionmre
  • b554cd5flogmre
  • f4c9440ddeploy.sh: tar --hard-dereference for the live data backupmre
  • 1a687b15Merge branch 'w48-member-merge'mre
  • 166c775fW48 report, logmre
  • 1b4623f0Members merge pull requests: API route, button on /pulls and /pulls/N, one shared merge pathmre
  • 1075c38cW48 mission, logmre
  • 17bdd0d6V37/V39 missions, logmre
  • 146de5f8Re-vendor gitoria to Hybriel set-day39 (51e921d7)mre
  • e874e44dtests/status-keyed: app token lives 60 s so it outlives the gate's two restartsmre
  • 270b8d61deploy.sh: DEPLOY_STOP_START=1 stops, waits for the old pid, then starts (mpackdb freeze, replaces the standby swap)mre
  • 3f9235b8project.hl: drop the dummy /pulls/:n component route (hybriel#294 is fixed in day37)mre
  • c90daf19Re-vendor gitoria to Hybriel set-day37 (f6b3d45b)mre
  • 03b5bb08W39 report to reports/, drop scratch repro, mission + logmre