gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitaafe330daafe330dTidy: drop evidence JSON (kept in scratch), collapse blank linesmreaafe330d/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

  • aafe330dTidy: drop evidence JSON (kept in scratch), collapse blank linesmre
  • aca1fda1Merge W61: theme from layouts 17e0f03, Views refer to Style rules (gitoria#37 #27)mre
  • 03cb650blog: W61 theme decisionmre
  • 248bce85Report final style gates, CSS mappings and 136 whole-image comparisonsmre
  • 153c344bRestore organization metadata exposed by the whole-image comparisonmre
  • 917a1465Update status gate assertions for the referenced state rulemre
  • 3cdb02c6Own settings feedback styles and explain connection-state classesmre
  • 00d5d6c4Reference code-entry styles and nest code-browser media and pseudosmre
  • 3c425eddReference PR content styles and explain dynamic state classesmre
  • e46fa222Own shell feedback styles and retain documented selector formsmre
  • c26084c4Reference repository list styles and nest its breakpointmre
  • f3e196b5Document Markdown direct-child selector remaindersmre
  • 70597528Reference pull list rules and explain runtime class predicatesmre
  • 1ce7ac24Reference ticket row and feedback styles from its Viewmre
  • 10cdf54bGive organization repository rows their own Style referencesmre
  • 0d019521Document shared class selectors in the styles-only filemre
  • c67404a7Scope token labels and feedback through the token Viewmre
  • 944e3dabScope key names, fingerprints and errors to the keys Viewmre
  • 7bcf7bc2Nest repo navigation media rules and document selector gapsmre
  • 46a76272Reference release row styles from the Viewmre