gitoria

tickets

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit41da352541da3525Tickets conductor: flake cause, T36 deploy stepmre41da3525/components/markdown.hl

6.5 KB

  1. // components/markdown.hl — A MARKDOWN TEXT, RENDERED (ticket #6): `Markdown { blocks = … }` with the
  2. // blocks of markdown.hl's markdownBlocks (the summary, a comment, a state note). The blocks are
  3. // plain data; every character of the source is a TEXT node here and a link's href was checked
  4. // by markdown.hl safeHref — no HTML string is ever built (no raw HTML, no scripts, no
  5. // `javascript:` links). Headings of the text become h3/h4/h5 (the page owns h1/h2). A table
  6. // (mission 013) is <markdown-table><table> with <th>/<td> carrying data-align (left/center/right/'').
  7. // The span markup is written out once per block kind: a View has no macros.
  8. blocks = []
  9. Style {
  10. // Line breaks inside a paragraph stay visible (the page showed the texts with pre-wrap before)
  11. markdownText { display = 'block'
  12. '> :first-child' { marginTop = '0' }
  13. '> :last-child' { marginBottom = '0' }
  14. p { whiteSpace = 'pre-wrap' margin = '.5rem 0' }
  15. h3 { margin = '.9rem 0 .4rem' lineHeight = '1.3' color = 'var(--color-text-strong)' fontSize = '1.15rem' }
  16. h4 { margin = '.9rem 0 .4rem' lineHeight = '1.3' color = 'var(--color-text-strong)' fontSize = '1.02rem' }
  17. h5 { margin = '.9rem 0 .4rem' lineHeight = '1.3' color = 'var(--color-text-strong)' fontSize = '.95rem' }
  18. // inside the history (itself an <ol>) a list would get the nested markers (circles): the list style is set here
  19. ul { margin = '.5rem 0' paddingLeft = '1.4rem' listStyleType = 'disc' }
  20. ol { margin = '.5rem 0' paddingLeft = '1.4rem' listStyleType = 'decimal' }
  21. li { whiteSpace = 'pre-wrap'
  22. '+ li' { marginTop = '.15rem' }
  23. }
  24. strong { color = 'var(--color-text-strong)' }
  25. a { textDecoration = 'underline' textUnderlineOffset = '.15em' overflowWrap = 'anywhere' }
  26. code { font = '.88em/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace' padding = '.05em .3em' color = 'var(--color-text-strong)' background = 'var(--color-background-sunken)' borderRadius = 'var(--radius-small)' }
  27. pre { margin = '.5rem 0' padding = '.6rem .7rem' overflowX = 'auto' background = 'var(--color-background-sunken)' borderRadius = 'var(--radius-small)'
  28. code { padding = '0' background = 'transparent' whiteSpace = 'pre' }
  29. }
  30. }
  31. // mission 013: pipe tables, black/white, thin grey lines; a wide table scrolls inside its own box (the page never scrolls sideways);
  32. // cells keep their words whole (no break-all) and wrap at spaces. `contain: inline-size`: the box's width never comes from the table,
  33. // the history and the sections are grids of auto columns, which would otherwise grow to the table's min-content width and push the
  34. // page sideways. The 1px padding keeps the outer half of the collapsed border inside the clip
  35. markdownTable { display = 'block' maxWidth = '100%' overflowX = 'auto' margin = '.5rem 0' padding = '1px' contain = 'inline-size'
  36. table { borderCollapse = 'collapse' }
  37. th { padding = '.3rem .6rem' textAlign = 'start' verticalAlign = 'top' minWidth = '2.5rem' overflowWrap = 'normal' wordBreak = 'normal' fontWeight = '700' color = 'var(--color-text-strong)' }
  38. td { padding = '.3rem .6rem' textAlign = 'start' verticalAlign = 'top' minWidth = '2.5rem' overflowWrap = 'normal' wordBreak = 'normal' }
  39. '[data-align="left"]' { textAlign = 'left' }
  40. '[data-align="center"]' { textAlign = 'center' }
  41. '[data-align="right"]' { textAlign = 'right' }
  42. }
  43. }
  44. View {
  45. markdownText {
  46. for (b of blocks) {
  47. if (b.isP) { p {
  48. for (s of b.spans) {
  49. if (s.isText) { s.text }
  50. if (s.isStrong) { strong { s.text } }
  51. if (s.isEm) { em { s.text } }
  52. if (s.isStrongEm) { strong { em { s.text } } }
  53. if (s.isCode) { code { s.text } }
  54. if (s.isLink) { a { href = s.href rel = "nofollow noopener noreferrer" s.text } }
  55. }
  56. } }
  57. if (b.isH1) { h3 {
  58. for (s of b.spans) {
  59. if (s.isText) { s.text }
  60. if (s.isStrong) { strong { s.text } }
  61. if (s.isEm) { em { s.text } }
  62. if (s.isStrongEm) { strong { em { s.text } } }
  63. if (s.isCode) { code { s.text } }
  64. if (s.isLink) { a { href = s.href rel = "nofollow noopener noreferrer" s.text } }
  65. }
  66. } }
  67. if (b.isH2) { h4 {
  68. for (s of b.spans) {
  69. if (s.isText) { s.text }
  70. if (s.isStrong) { strong { s.text } }
  71. if (s.isEm) { em { s.text } }
  72. if (s.isStrongEm) { strong { em { s.text } } }
  73. if (s.isCode) { code { s.text } }
  74. if (s.isLink) { a { href = s.href rel = "nofollow noopener noreferrer" s.text } }
  75. }
  76. } }
  77. if (b.isH3) { h5 {
  78. for (s of b.spans) {
  79. if (s.isText) { s.text }
  80. if (s.isStrong) { strong { s.text } }
  81. if (s.isEm) { em { s.text } }
  82. if (s.isStrongEm) { strong { em { s.text } } }
  83. if (s.isCode) { code { s.text } }
  84. if (s.isLink) { a { href = s.href rel = "nofollow noopener noreferrer" s.text } }
  85. }
  86. } }
  87. if (b.isUl) { ul {
  88. for (it of b.items) { li {
  89. for (s of it.spans) {
  90. if (s.isText) { s.text }
  91. if (s.isStrong) { strong { s.text } }
  92. if (s.isEm) { em { s.text } }
  93. if (s.isStrongEm) { strong { em { s.text } } }
  94. if (s.isCode) { code { s.text } }
  95. if (s.isLink) { a { href = s.href rel = "nofollow noopener noreferrer" s.text } }
  96. }
  97. } }
  98. } }
  99. if (b.isOl) { ol { start = b.start
  100. for (it of b.items) { li {
  101. for (s of it.spans) {
  102. if (s.isText) { s.text }
  103. if (s.isStrong) { strong { s.text } }
  104. if (s.isEm) { em { s.text } }
  105. if (s.isStrongEm) { strong { em { s.text } } }
  106. if (s.isCode) { code { s.text } }
  107. if (s.isLink) { a { href = s.href rel = "nofollow noopener noreferrer" s.text } }
  108. }
  109. } }
  110. } }
  111. if (b.isCode) { pre { code { b.code } } }
  112. // mission 013: a pipe table, in a box that scrolls sideways when it is wider than the text
  113. if (b.isTable) { markdownTable { table {
  114. thead { tr {
  115. for (c of b.head) { th { "data-align" = c.align
  116. for (s of c.spans) {
  117. if (s.isText) { s.text }
  118. if (s.isStrong) { strong { s.text } }
  119. if (s.isEm) { em { s.text } }
  120. if (s.isStrongEm) { strong { em { s.text } } }
  121. if (s.isCode) { code { s.text } }
  122. if (s.isLink) { a { href = s.href rel = "nofollow noopener noreferrer" s.text } }
  123. }
  124. } }
  125. } }
  126. tbody {
  127. for (r of b.rows) { tr {
  128. for (c of r.cells) { td { "data-align" = c.align
  129. for (s of c.spans) {
  130. if (s.isText) { s.text }
  131. if (s.isStrong) { strong { s.text } }
  132. if (s.isEm) { em { s.text } }
  133. if (s.isStrongEm) { strong { em { s.text } } }
  134. if (s.isCode) { code { s.text } }
  135. if (s.isLink) { a { href = s.href rel = "nofollow noopener noreferrer" s.text } }
  136. }
  137. } }
  138. } }
  139. }
  140. } } }
  141. }
  142. }
  143. }

Branches

Latest commits

  • 41da3525Tickets conductor: flake cause, T36 deploy stepmre
  • 64c477e6Tickets conductor: deploy waits for Arachnemre
  • 467d7286Tickets conductor: T36 done, deploy questionmre
  • 8542fc8aTickets conductor: T36 proof reviewedmre
  • 2a5b8b91Tickets conductor: T36 cap stop, resumed for proofmre
  • 6a82097fTickets conductor: Arachne W228 on day35 flakemre
  • 0ee5a6f2Tickets conductor: T36 resumedmre
  • 9149c165Tickets conductor: T36 diagnosismre
  • 91713313Tickets conductor: T36 report 1mre
  • 756315d2Tickets conductor: T36 startedmre
  • 0814ce6bTickets conductor: brief 025 tickets#36 style formmre
  • 1b6916c4Tickets conductor: Atlas handover tickets#36mre
  • aab95226Tickets conductor: worldapi-conductor paths, deploy blocker = read-only diskmre
  • 6372b06dTickets conductor: worker port slotmre
  • 836af31cTickets conductor: token pathsmre
  • b03f11b6Tickets conductor: CONDUCTOR.md (project part), short STATUS.md, old STATUS to archive/2026-10-31mre
  • a4123831tickets#42: the /connect and /login/callback error pages are app pages: the function routes redirect to /connect/failed/<code> and /login/failed/<code> (components/problem.hl, sentences in lib/problems.hl), htmlPage and its hand-written stylesheet are gone; gate tests/error-pages.mjsmre
  • cefc7b4atickets: a startup error prints its message before exit 1 (hybriel#247)mre
  • 99bd6570tickets: lib/migrate.hl writes no table of another topic any more: projects.hl rewriteSlug / addProjectNamed / hasMembers, tickets.hl moveToProject / ticketRecords / ticketRecordsOf, events.hl renameStates / eventRecords / eventRecordsOf; the migration calls them (tickets#47)mre
  • b57161e3tickets: the markup names its own rules (Style.pMessage, Style.olTickets, ...) instead of hand-written class strings that copy a stylesheet rule; the shared bodies sit in lib/looks.hl (tickets#38)mre