gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit1c3fa8421c3fa842gitoria#45 #47: worker briefsmre1c3fa842/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

  • 1c3fa842gitoria#45 #47: worker briefsmre
  • 0a46bf7dgitoria#47: apps API contract v1.3 (status read route, statuses + required on the pull)mre
  • 3373f7c3gitoria#38: push API contract v1.2.1, reviews, worker briefs and logmre
  • 34143d2cgitoria#46: closing brace of appComments lost in the mergemre
  • 54927c9cgitoria#46: PR statuses and required checks before merge (merge w46-status)mre
  • 187e1871gitoria#46: badges without decorative bordersmre
  • 6b022798gitoria#46: tests/status.mjs in GATESmre
  • c6162f00gitoria#46: status badges on /pulls, Required before merge in Settingsmre
  • e5a0b64egitoria#46: PUT statuses/<sha>, required contexts block the merge on the servermre
  • 26a140e3gitoria#44: reviews, inline threads, replies, conversation for apps (merge w44-reviews)mre
  • 888dbf87gitoria#44: unknown API paths answer the contract's JSON 404 and sit above the page routesmre
  • ea587d90gitoria#44: reviews with inline threads, replies, resolve and the PR conversation for apps (lib/reviews.hl, tests/reviews.mjs)mre
  • 49533a50gitoria#43: signed events to connected apps (merge w43-events)mre
  • 1a1e87d5gitoria#43: the sender never writes the apps row; Settings shows the newest deliverymre
  • cd442066gitoria#43: app-auth unit test reads the apps table from its new filemre
  • 5dccbe38gitoria#43: in-flight rows are left alone by the other process; gate in deploy.sh; READMEmre
  • 8c8805f3merge main (gitoria#42), delivery log and redelivery routes, sweep fixmre
  • 5a996ea8gitoria#42: short-lived app tokens, read-only git fetch with them (merge w42-app-token)mre
  • afdb0cbfgitoria#43: rename the moved helper (name clash in the browser build)mre
  • 15e01e94gitoria#43: tests/events.mjs and its probemre