├── docs ├── favicon.ico ├── media │ ├── card.png │ ├── image.png │ └── screen.png ├── favicon-16x16.png ├── favicon-32x32.png ├── normalize.css └── index.html ├── .travis.yml ├── .editorconfig ├── .gitignore ├── package.json ├── LICENSE ├── readme.md └── rapido.css /docs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nextbitlabs/Rapido/HEAD/docs/favicon.ico -------------------------------------------------------------------------------- /docs/media/card.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nextbitlabs/Rapido/HEAD/docs/media/card.png -------------------------------------------------------------------------------- /docs/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nextbitlabs/Rapido/HEAD/docs/favicon-16x16.png -------------------------------------------------------------------------------- /docs/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nextbitlabs/Rapido/HEAD/docs/favicon-32x32.png -------------------------------------------------------------------------------- /docs/media/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nextbitlabs/Rapido/HEAD/docs/media/image.png -------------------------------------------------------------------------------- /docs/media/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nextbitlabs/Rapido/HEAD/docs/media/screen.png -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | os: 2 | - linux 3 | language: node_js 4 | node_js: stable 5 | 6 | notifications: 7 | - email: false 8 | 9 | script: 10 | - npm run test 11 | 12 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = tab 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | 4 | # local env files 5 | .env.local 6 | .env.*.local 7 | 8 | # Log files 9 | npm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | 13 | # Editor directories and files 14 | .idea 15 | .vscode 16 | *.suo 17 | *.ntvs* 18 | *.njsproj 19 | *.sln 20 | *.sw* -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@nextbitlabs/rapido", 3 | "version": "3.2.0", 4 | "description": "Rapido.css: semantic HTML for your writings.", 5 | "main": "rapido.css", 6 | "style": "rapido.css", 7 | "files": [ 8 | "LICENSE", 9 | "rapido.css" 10 | ], 11 | "scripts": { 12 | "test": "stylelint rapido.css" 13 | }, 14 | "repository": "nextbitlabs/Rapido", 15 | "license": "MIT", 16 | "bugs": "https://github.com/nextbitlabs/Rapido/issues", 17 | "homepage": "https://nextbitlabs.github.io/Rapido/", 18 | "devDependencies": { 19 | "stylelint": "^13.2.0", 20 | "stylelint-config-standard": "^20.0.0" 21 | }, 22 | "stylelint": { 23 | "extends": "stylelint-config-standard", 24 | "rules": { 25 | "indentation": "tab" 26 | } 27 | }, 28 | "dependencies": {} 29 | } 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018-2019 Nextbit 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | # Rapido.css 4 | 5 | Write your blog posts with semantic HTML. 6 | 7 | ![Latest Release](https://badgen.net/github/release/nextbitlabs/Rapido) 8 | ![Code Style Stylelint](https://badgen.net/badge/code%20style/stylelint/yellow) 9 | ![MIT](https://badgen.net/badge/license/MIT/green) 10 | 11 | 12 |
13 | 14 | ## Introduction 15 | 16 | Rapido provides a default style for a set of **semantic HTML** elements that you can use to compose your essays. Just write with semantic HTML, without the need to remember any CSS class or JS command. 17 | 18 | Rapido has been crafted with the idea that using semantic HTML for your writings *can be easy*. For such a reason Rapido does not make use of CSS classes, with the exception of class `rapido`, of course. Authors can compose all the different parts of the document with semantic HTML elements, for example adding side notes in paragraphs with the `` element. 19 | 20 | ```html 21 |
22 |
23 |

...

24 |

......

25 |
26 |
27 | ``` 28 | 29 | ## Motivation 30 | 31 | The importance of using [semantic HTML](https://developer.mozilla.org/en-US/docs/Glossary/semantics#Semantics_in_HTML) is a common theme in web development, it is a good idea to use the relevant HTML element for the job. Semantic HTML improves the usability of the code and ensures maximum [accessibility](https://developer.mozilla.org/en-US/docs/Learn/Accessibility/HTML). 32 | 33 | Having your own corner on the web where you can freely share thoughts or technical stuff [is still cool](https://medium.com/@dan_abramov/why-my-new-blog-isnt-on-medium-3b280282fbae), and the popularity of tools like [Jekyll](https://jekyllrb.com/) or [Gatsby](https://www.gatsbyjs.org/) proves that. Rapido intervenes there, offering semantic HTML templates for a variety of typical author needs: like header, sections, side notes, references and so on. 34 | 35 | ## Docs 36 | 37 | Please have a look at https://nextbitlabs.github.io/Rapido/ for the documentation. 38 | 39 | ## License 40 | 41 | This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. 42 | -------------------------------------------------------------------------------- /docs/normalize.css: -------------------------------------------------------------------------------- 1 | /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ 2 | 3 | /* Document 4 | ========================================================================== */ 5 | 6 | /** 7 | * 1. Correct the line height in all browsers. 8 | * 2. Prevent adjustments of font size after orientation changes in iOS. 9 | */ 10 | 11 | html { 12 | line-height: 1.15; /* 1 */ 13 | -webkit-text-size-adjust: 100%; /* 2 */ 14 | } 15 | 16 | /* Sections 17 | ========================================================================== */ 18 | 19 | /** 20 | * Remove the margin in all browsers. 21 | */ 22 | 23 | body { 24 | margin: 0; 25 | } 26 | 27 | /** 28 | * Render the `main` element consistently in IE. 29 | */ 30 | 31 | main { 32 | display: block; 33 | } 34 | 35 | /** 36 | * Correct the font size and margin on `h1` elements within `section` and 37 | * `article` contexts in Chrome, Firefox, and Safari. 38 | */ 39 | 40 | h1 { 41 | font-size: 2em; 42 | margin: 0.67em 0; 43 | } 44 | 45 | /* Grouping content 46 | ========================================================================== */ 47 | 48 | /** 49 | * 1. Add the correct box sizing in Firefox. 50 | * 2. Show the overflow in Edge and IE. 51 | */ 52 | 53 | hr { 54 | box-sizing: content-box; /* 1 */ 55 | height: 0; /* 1 */ 56 | overflow: visible; /* 2 */ 57 | } 58 | 59 | /** 60 | * 1. Correct the inheritance and scaling of font size in all browsers. 61 | * 2. Correct the odd `em` font sizing in all browsers. 62 | */ 63 | 64 | pre { 65 | font-family: monospace, monospace; /* 1 */ 66 | font-size: 1em; /* 2 */ 67 | } 68 | 69 | /* Text-level semantics 70 | ========================================================================== */ 71 | 72 | /** 73 | * Remove the gray background on active links in IE 10. 74 | */ 75 | 76 | a { 77 | background-color: transparent; 78 | } 79 | 80 | /** 81 | * 1. Remove the bottom border in Chrome 57- 82 | * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. 83 | */ 84 | 85 | abbr[title] { 86 | border-bottom: none; /* 1 */ 87 | text-decoration: underline; /* 2 */ 88 | text-decoration: underline dotted; /* 2 */ 89 | } 90 | 91 | /** 92 | * Add the correct font weight in Chrome, Edge, and Safari. 93 | */ 94 | 95 | b, 96 | strong { 97 | font-weight: bolder; 98 | } 99 | 100 | /** 101 | * 1. Correct the inheritance and scaling of font size in all browsers. 102 | * 2. Correct the odd `em` font sizing in all browsers. 103 | */ 104 | 105 | code, 106 | kbd, 107 | samp { 108 | font-family: monospace, monospace; /* 1 */ 109 | font-size: 1em; /* 2 */ 110 | } 111 | 112 | /** 113 | * Add the correct font size in all browsers. 114 | */ 115 | 116 | small { 117 | font-size: 80%; 118 | } 119 | 120 | /** 121 | * Prevent `sub` and `sup` elements from affecting the line height in 122 | * all browsers. 123 | */ 124 | 125 | sub, 126 | sup { 127 | font-size: 75%; 128 | line-height: 0; 129 | position: relative; 130 | vertical-align: baseline; 131 | } 132 | 133 | sub { 134 | bottom: -0.25em; 135 | } 136 | 137 | sup { 138 | top: -0.5em; 139 | } 140 | 141 | /* Embedded content 142 | ========================================================================== */ 143 | 144 | /** 145 | * Remove the border on images inside links in IE 10. 146 | */ 147 | 148 | img { 149 | border-style: none; 150 | } 151 | 152 | /* Forms 153 | ========================================================================== */ 154 | 155 | /** 156 | * 1. Change the font styles in all browsers. 157 | * 2. Remove the margin in Firefox and Safari. 158 | */ 159 | 160 | button, 161 | input, 162 | optgroup, 163 | select, 164 | textarea { 165 | font-family: inherit; /* 1 */ 166 | font-size: 100%; /* 1 */ 167 | line-height: 1.15; /* 1 */ 168 | margin: 0; /* 2 */ 169 | } 170 | 171 | /** 172 | * Show the overflow in IE. 173 | * 1. Show the overflow in Edge. 174 | */ 175 | 176 | button, 177 | input { /* 1 */ 178 | overflow: visible; 179 | } 180 | 181 | /** 182 | * Remove the inheritance of text transform in Edge, Firefox, and IE. 183 | * 1. Remove the inheritance of text transform in Firefox. 184 | */ 185 | 186 | button, 187 | select { /* 1 */ 188 | text-transform: none; 189 | } 190 | 191 | /** 192 | * Correct the inability to style clickable types in iOS and Safari. 193 | */ 194 | 195 | button, 196 | [type="button"], 197 | [type="reset"], 198 | [type="submit"] { 199 | -webkit-appearance: button; 200 | } 201 | 202 | /** 203 | * Remove the inner border and padding in Firefox. 204 | */ 205 | 206 | button::-moz-focus-inner, 207 | [type="button"]::-moz-focus-inner, 208 | [type="reset"]::-moz-focus-inner, 209 | [type="submit"]::-moz-focus-inner { 210 | border-style: none; 211 | padding: 0; 212 | } 213 | 214 | /** 215 | * Restore the focus styles unset by the previous rule. 216 | */ 217 | 218 | button:-moz-focusring, 219 | [type="button"]:-moz-focusring, 220 | [type="reset"]:-moz-focusring, 221 | [type="submit"]:-moz-focusring { 222 | outline: 1px dotted ButtonText; 223 | } 224 | 225 | /** 226 | * Correct the padding in Firefox. 227 | */ 228 | 229 | fieldset { 230 | padding: 0.35em 0.75em 0.625em; 231 | } 232 | 233 | /** 234 | * 1. Correct the text wrapping in Edge and IE. 235 | * 2. Correct the color inheritance from `fieldset` elements in IE. 236 | * 3. Remove the padding so developers are not caught out when they zero out 237 | * `fieldset` elements in all browsers. 238 | */ 239 | 240 | legend { 241 | box-sizing: border-box; /* 1 */ 242 | color: inherit; /* 2 */ 243 | display: table; /* 1 */ 244 | max-width: 100%; /* 1 */ 245 | padding: 0; /* 3 */ 246 | white-space: normal; /* 1 */ 247 | } 248 | 249 | /** 250 | * Add the correct vertical alignment in Chrome, Firefox, and Opera. 251 | */ 252 | 253 | progress { 254 | vertical-align: baseline; 255 | } 256 | 257 | /** 258 | * Remove the default vertical scrollbar in IE 10+. 259 | */ 260 | 261 | textarea { 262 | overflow: auto; 263 | } 264 | 265 | /** 266 | * 1. Add the correct box sizing in IE 10. 267 | * 2. Remove the padding in IE 10. 268 | */ 269 | 270 | [type="checkbox"], 271 | [type="radio"] { 272 | box-sizing: border-box; /* 1 */ 273 | padding: 0; /* 2 */ 274 | } 275 | 276 | /** 277 | * Correct the cursor style of increment and decrement buttons in Chrome. 278 | */ 279 | 280 | [type="number"]::-webkit-inner-spin-button, 281 | [type="number"]::-webkit-outer-spin-button { 282 | height: auto; 283 | } 284 | 285 | /** 286 | * 1. Correct the odd appearance in Chrome and Safari. 287 | * 2. Correct the outline style in Safari. 288 | */ 289 | 290 | [type="search"] { 291 | -webkit-appearance: textfield; /* 1 */ 292 | outline-offset: -2px; /* 2 */ 293 | } 294 | 295 | /** 296 | * Remove the inner padding in Chrome and Safari on macOS. 297 | */ 298 | 299 | [type="search"]::-webkit-search-decoration { 300 | -webkit-appearance: none; 301 | } 302 | 303 | /** 304 | * 1. Correct the inability to style clickable types in iOS and Safari. 305 | * 2. Change font properties to `inherit` in Safari. 306 | */ 307 | 308 | ::-webkit-file-upload-button { 309 | -webkit-appearance: button; /* 1 */ 310 | font: inherit; /* 2 */ 311 | } 312 | 313 | /* Interactive 314 | ========================================================================== */ 315 | 316 | /* 317 | * Add the correct display in Edge, IE 10+, and Firefox. 318 | */ 319 | 320 | details { 321 | display: block; 322 | } 323 | 324 | /* 325 | * Add the correct display in all browsers. 326 | */ 327 | 328 | summary { 329 | display: list-item; 330 | } 331 | 332 | /* Misc 333 | ========================================================================== */ 334 | 335 | /** 336 | * Add the correct display in IE 10+. 337 | */ 338 | 339 | template { 340 | display: none; 341 | } 342 | 343 | /** 344 | * Add the correct display in IE 10. 345 | */ 346 | 347 | [hidden] { 348 | display: none; 349 | } 350 | -------------------------------------------------------------------------------- /rapido.css: -------------------------------------------------------------------------------- 1 | /* all elements */ 2 | 3 | article.rapido * { 4 | box-sizing: border-box; 5 | padding: 0; 6 | margin: 0; 7 | } 8 | 9 | /* end all elements */ 10 | 11 | /* address */ 12 | 13 | article.rapido > header > address { 14 | display: block; 15 | margin-bottom: 20px; 16 | font-style: normal; 17 | font-size: 18px; 18 | line-height: 30px; 19 | } 20 | 21 | /* end address */ 22 | 23 | /* article */ 24 | 25 | article.rapido { 26 | width: 1024px; 27 | max-width: 100%; 28 | box-sizing: border-box; 29 | margin: auto; 30 | padding: 0 40px; 31 | font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; 32 | -webkit-font-smoothing: antialiased; 33 | -moz-osx-font-smoothing: grayscale; 34 | -webkit-text-size-adjust: 100%; 35 | color: #353839; 36 | } 37 | 38 | @media (max-width: 1023px) { 39 | article.rapido { 40 | width: 600px; 41 | padding: 0 20px 0 20px; 42 | } 43 | } 44 | 45 | /* end article */ 46 | 47 | /* aside */ 48 | 49 | article.rapido section > aside { 50 | width: 600px; 51 | max-width: 100%; 52 | border-top: 2px solid #353839; 53 | border-bottom: 2px solid #353839; 54 | margin: 0 0 20px 0; 55 | padding-top: 20px; 56 | } 57 | 58 | /* end aside */ 59 | 60 | /* header */ 61 | 62 | article.rapido > header { 63 | width: 100%; 64 | margin: 50px 0; 65 | } 66 | 67 | @media (max-width: 1023px) { 68 | article.rapido > header { 69 | margin: 30px 0; 70 | } 71 | } 72 | 73 | /* end header */ 74 | 75 | /* footer */ 76 | 77 | article.rapido > footer { 78 | border-top: 1px solid #dedede; 79 | padding: 10px 0 20px 0; 80 | opacity: 0.7; 81 | } 82 | 83 | /* end footer */ 84 | 85 | /* h1 */ 86 | 87 | article.rapido section > h1 { 88 | width: 600px; 89 | max-width: 100%; 90 | margin: 0 0 30px 0; 91 | font-size: 30px; 92 | line-height: 45px; 93 | font-weight: bold; 94 | } 95 | 96 | article.rapido > header > h1 { 97 | margin: 0 0 50px 0; 98 | font-size: 60px; 99 | line-height: 80px; 100 | font-weight: bold; 101 | } 102 | 103 | article.rapido > footer > h1 { 104 | margin: 20px 0 10px 0; 105 | } 106 | 107 | article.rapido > footer > h1, 108 | article.rapido > footer > section > h1 { 109 | font-size: 12px; 110 | line-height: 18px; 111 | text-transform: uppercase; 112 | margin: 0 0 10px 0; 113 | } 114 | 115 | @media (min-width: 1024px) { 116 | article.rapido > footer > section > h1 { 117 | margin: 0; 118 | max-width: 200px; 119 | position: absolute; 120 | padding-right: 20px; 121 | } 122 | } 123 | 124 | article.rapido section figcaption > h1, 125 | article.rapido > header > figure > figcaption > h1 { 126 | display: inline; 127 | padding: 0; 128 | font-size: 14px; 129 | line-height: 21px; 130 | font-weight: bold; 131 | } 132 | 133 | article.rapido > footer figure > figcaption > h1 { 134 | display: inline; 135 | font-size: 12px; 136 | line-height: 18px; 137 | padding: 0; 138 | font-weight: bold; 139 | text-transform: unset; 140 | } 141 | 142 | @media (max-width: 1023px) { 143 | article.rapido > header > h1 { 144 | font-size: 40px; 145 | line-height: 60px; 146 | } 147 | } 148 | 149 | @media (max-width: 499px) { 150 | article.rapido section > h1 { 151 | font-size: 24px; 152 | line-height: 36px; 153 | } 154 | 155 | article.rapido > header > h1 { 156 | font-size: 30px; 157 | line-height: 45px; 158 | } 159 | } 160 | 161 | /* end h1 */ 162 | 163 | /* h2 */ 164 | 165 | article.rapido section > h2 { 166 | width: 600px; 167 | max-width: 100%; 168 | margin: 0 0 20px 0; 169 | font-size: 20px; 170 | line-height: 30px; 171 | font-weight: bold; 172 | } 173 | 174 | article.rapido > footer > h2, 175 | article.rapido > footer > section > h2 { 176 | width: 100%; 177 | margin: 0 0 10px 0; 178 | font-size: 12px; 179 | line-height: 18px; 180 | } 181 | 182 | @media (min-width: 1024px) { 183 | article.rapido > footer > section > h2 { 184 | max-width: calc(100% - 200px); 185 | margin-left: 200px; 186 | } 187 | } 188 | 189 | /* end h2 */ 190 | 191 | /* h3 */ 192 | 193 | article.rapido section > h3 { 194 | width: 600px; 195 | max-width: 100%; 196 | margin: 0 0 20px 0; 197 | font-size: 18px; 198 | line-height: 30px; 199 | font-weight: bold; 200 | } 201 | 202 | /* end h3 */ 203 | 204 | /* section */ 205 | 206 | article.rapido section { 207 | width: 100%; 208 | padding: 10px 0; 209 | } 210 | 211 | article.rapido > footer > section { 212 | padding: 10px 0; 213 | } 214 | 215 | @media (min-width: 1024px) { 216 | article.rapido > footer > section { 217 | padding: 20px 0; 218 | } 219 | } 220 | 221 | /* end section */ 222 | 223 | /* blockquote */ 224 | 225 | article.rapido section > blockquote { 226 | width: 600px; 227 | max-width: 100%; 228 | padding: 20px 40px 0 40px; 229 | } 230 | 231 | @media (max-width: 380px) { 232 | article.rapido section > blockquote { 233 | padding: 20px 20px 0 20px; 234 | } 235 | } 236 | 237 | /* end blockquote */ 238 | 239 | /* div */ 240 | 241 | article.rapido div { 242 | display: block; 243 | flex: 0 0 auto; 244 | max-width: 100%; 245 | margin: 0 20px 0 0; 246 | overflow-y: hidden; 247 | overflow-x: auto; 248 | } 249 | 250 | article.rapido > section div { 251 | width: 600px; 252 | } 253 | 254 | article.rapido > section > div { 255 | margin: 0 0 20px 0; 256 | } 257 | 258 | article.rapido > footer div, 259 | article.rapido > header div { 260 | width: 100%; 261 | } 262 | 263 | article.rapido > header > div { 264 | margin: 0 0 20px 0; 265 | } 266 | 267 | article.rapido > footer > section > div { 268 | margin: 0 0 10px 0; 269 | } 270 | 271 | @media (min-width: 1024px) { 272 | article.rapido > footer > section > div { 273 | width: calc(100% - 200px); 274 | margin: 0 0 10px 200px; 275 | } 276 | } 277 | 278 | /* end div */ 279 | 280 | /* figcaption */ 281 | 282 | article.rapido figcaption { 283 | flex: 1 1; 284 | min-width: 140px; 285 | max-width: 100%; 286 | margin-top: 3px; 287 | } 288 | 289 | /* end figcaption */ 290 | 291 | /* figure */ 292 | 293 | article.rapido figure { 294 | display: flex; 295 | flex-wrap: wrap; 296 | align-items: flex-start; 297 | margin: 20px 0; 298 | } 299 | 300 | article.rapido > footer figure { 301 | margin: 10px 0; 302 | } 303 | 304 | @media (min-width: 1024px) { 305 | article.rapido > footer > section > figure { 306 | margin: 10px 0 10px 200px; 307 | } 308 | } 309 | 310 | /* end figure */ 311 | 312 | /* li */ 313 | 314 | article.rapido li { 315 | font-size: 14px; 316 | line-height: 21px; 317 | } 318 | 319 | article.rapido > footer li { 320 | width: 100%; 321 | font-size: 12px; 322 | line-height: 18px; 323 | margin-bottom: 10px; 324 | } 325 | 326 | /* end li */ 327 | 328 | /* ol, ul */ 329 | 330 | article.rapido ol, 331 | article.rapido ul { 332 | width: 600px; 333 | max-width: 100%; 334 | margin: 0 0 20px 0; 335 | list-style-position: inside; 336 | } 337 | 338 | article.rapido ul { 339 | list-style-type: disc; 340 | } 341 | 342 | article.rapido ol { 343 | list-style-type: decimal; 344 | } 345 | 346 | article.rapido > footer ul, 347 | article.rapido > footer ol { 348 | margin: 0; 349 | } 350 | 351 | @media (min-width: 1024px) { 352 | article.rapido > footer > section > ol, 353 | article.rapido > footer > section > ul { 354 | margin: 0 0 10px 200px; 355 | width: calc(100% - 200px); 356 | } 357 | } 358 | 359 | /* end ol, ul */ 360 | 361 | /* p */ 362 | 363 | article.rapido p, 364 | article.rapido section p { 365 | position: relative; 366 | width: 600px; 367 | max-width: 100%; 368 | margin: 0 0 20px 0; 369 | font-size: 18px; 370 | line-height: 30px; 371 | } 372 | 373 | article.rapido > header > p { 374 | width: 100%; 375 | font-size: 30px; 376 | line-height: 45px; 377 | } 378 | 379 | @media (max-width: 499px) { 380 | article.rapido > header > p { 381 | font-size: 24px; 382 | line-height: 36px; 383 | } 384 | } 385 | 386 | article.rapido > footer p { 387 | width: 100%; 388 | margin: 0 0 10px 0; 389 | font-size: 12px; 390 | line-height: 18px; 391 | } 392 | 393 | article.rapido li > p { 394 | display: inline; 395 | font-size: 14px; 396 | line-height: 21px; 397 | } 398 | 399 | article.rapido section figure > p { 400 | display: block; 401 | flex: 0 0 auto; 402 | height: auto; 403 | margin: 0 20px 0 0; 404 | } 405 | 406 | article.rapido section > blockquote > p { 407 | font-size: 18px; 408 | line-height: 27px; 409 | } 410 | 411 | article.rapido section > blockquote > p::before { 412 | content: '“'; 413 | } 414 | 415 | article.rapido section > blockquote > p::after { 416 | content: '”'; 417 | } 418 | 419 | article.rapido section figcaption > p { 420 | display: inline; 421 | font-size: 14px; 422 | line-height: 21px; 423 | } 424 | 425 | article.rapido section > aside > p { 426 | width: 100%; 427 | position: relative; 428 | margin: 0 0 20px 0; 429 | font-size: 30px; 430 | line-height: 45px; 431 | } 432 | 433 | @media (min-width: 1024px) { 434 | article.rapido > footer > section > p { 435 | width: calc(100% - 200px); 436 | margin: 0 0 10px 200px; 437 | } 438 | } 439 | 440 | article.rapido > footer figcaption > p { 441 | padding: 0; 442 | } 443 | 444 | article.rapido > header > figure > figcaption > p { 445 | display: inline; 446 | font-size: 14px; 447 | line-height: 21px; 448 | } 449 | 450 | /* end p */ 451 | 452 | /* pre */ 453 | 454 | article.rapido pre { 455 | display: block; 456 | flex: 0 0 auto; 457 | max-width: 100%; 458 | padding: 5px 0; 459 | margin: 0 20px 0 0; 460 | overflow-y: hidden; 461 | overflow-x: auto; 462 | border-radius: 2px; 463 | font-family: "Consolas", "Courier", monospace; 464 | background: 465 | repeating-linear-gradient( 466 | -45deg, 467 | #f5f5f5, 468 | #f5f5f5 3px, 469 | #f7f7f7 3px, 470 | #f7f7f7 6px 471 | ); 472 | font-size: 14px; 473 | line-height: 21px; 474 | } 475 | 476 | article.rapido > section pre { 477 | width: 600px; 478 | } 479 | 480 | article.rapido > section > pre { 481 | margin: 0 0 20px 0; 482 | } 483 | 484 | article.rapido > footer pre { 485 | width: 100%; 486 | font-size: 12px; 487 | line-height: 18px; 488 | } 489 | 490 | article.rapido > header pre { 491 | width: 600px; 492 | } 493 | 494 | article.rapido > header > pre { 495 | margin: 0 0 20px 0; 496 | } 497 | 498 | article.rapido > footer > section > pre { 499 | margin: 0 0 10px 0; 500 | } 501 | 502 | @media (min-width: 1024px) { 503 | article.rapido > footer > section > pre { 504 | width: calc(100% - 200px); 505 | margin: 0 0 10px 200px; 506 | } 507 | } 508 | 509 | /* end pre */ 510 | 511 | /* a */ 512 | 513 | article.rapido a { 514 | font-size: inherit; 515 | line-height: inherit; 516 | color: inherit; 517 | text-decoration: underline; 518 | } 519 | 520 | article.rapido cite > a { 521 | text-decoration: none; 522 | } 523 | 524 | article.rapido > header > address > a { 525 | margin: 5px 15px 5px 0; 526 | } 527 | 528 | /* end a */ 529 | 530 | /* cite */ 531 | 532 | article.rapido cite { 533 | font-style: normal; 534 | } 535 | 536 | article.rapido section > cite { 537 | display: block; 538 | width: 100%; 539 | max-width: 600px; 540 | margin: 0 0 20px 0; 541 | text-align: right; 542 | font-size: 16px; 543 | line-height: 24px; 544 | } 545 | 546 | article.rapido section > cite::before { 547 | content: "– "; 548 | } 549 | 550 | /* end cite */ 551 | 552 | /* code */ 553 | 554 | article.rapido code { 555 | font-family: "Consolas", "Courier", monospace; 556 | font-size: inherit; 557 | line-height: inherit; 558 | color: blue; 559 | } 560 | 561 | article.rapido pre > code { 562 | display: inline-block; 563 | padding: 0 10px; 564 | } 565 | 566 | article.rapido > footer code { 567 | color: #353830; 568 | } 569 | 570 | article.rapido pre > mark > code { 571 | display: inline-block; 572 | min-width: 100%; 573 | padding: 0 8px; 574 | border-left: 2px solid blue; 575 | background: rgba(0, 0, 255, 0.05); 576 | } 577 | 578 | article.rapido > footer pre > mark > code { 579 | border-left: 2px solid #353839; 580 | background: rgba(0, 0, 0, 0.05); 581 | } 582 | 583 | /* end code */ 584 | 585 | /* mark */ 586 | 587 | article.rapido mark { 588 | background: rgba(0, 0, 255, 0.1); 589 | color: inherit; 590 | } 591 | 592 | article.rapido pre > mark { 593 | background: none; 594 | } 595 | 596 | /* end mark */ 597 | 598 | /* small */ 599 | 600 | article.rapido small { 601 | position: absolute; 602 | width: 324px; 603 | padding: 3px 0 0 0; 604 | top: 0; 605 | right: calc(-324px - 20px); 606 | float: right; 607 | font-size: 14px; 608 | line-height: 21px; 609 | } 610 | 611 | @media (max-width: 1023px) { 612 | article.rapido small { 613 | display: block; 614 | position: relative; 615 | width: 100%; 616 | right: 0; 617 | float: none; 618 | margin: 20px 0; 619 | padding: 0; 620 | } 621 | } 622 | 623 | @media (min-width: 601px) and (max-width: 1023px) { 624 | article.rapido small { 625 | overflow: auto; 626 | } 627 | } 628 | 629 | /* end small */ 630 | 631 | /* inline elements */ 632 | 633 | article.rapido strong { 634 | font-style: normal; 635 | font-weight: bold; 636 | } 637 | 638 | article.rapido q, 639 | article.rapido em { 640 | font-style: italic; 641 | font-weight: normal; 642 | } 643 | 644 | /* end inline elements */ 645 | 646 | /* img, video */ 647 | 648 | article.rapido img, 649 | article.rapido video { 650 | display: block; 651 | flex: 0 0 auto; 652 | max-width: 100%; 653 | height: auto; 654 | margin: 0 20px 0 0; 655 | border-radius: 2px; 656 | } 657 | 658 | article.rapido p > img { 659 | vertical-align: middle; 660 | } 661 | 662 | article.rapido small > img { 663 | max-width: 100%; 664 | padding-top: 5px; 665 | } 666 | 667 | @media (min-width: 601px) and (max-width: 1023px) { 668 | article.rapido small > img { 669 | max-width: 324px; 670 | float: right; 671 | } 672 | } 673 | 674 | article.rapido > section img, 675 | article.rapido > section video { 676 | width: 600px; 677 | } 678 | 679 | article.rapido > section > img, 680 | article.rapido > section > video { 681 | margin: 0 0 20px 0; 682 | } 683 | 684 | article.rapido > footer img, 685 | article.rapido > footer video, 686 | article.rapido > header img, 687 | article.rapido > header video { 688 | width: 100%; 689 | } 690 | 691 | article.rapido > header > img, 692 | article.rapido > header > video { 693 | margin: 0 0 20px 0; 694 | } 695 | 696 | article.rapido > footer > section > img, 697 | article.rapido > footer > section > video { 698 | margin: 0 0 10px 0; 699 | } 700 | 701 | @media (min-width: 1024px) { 702 | article.rapido > footer > section > img, 703 | article.rapido > footer > section > video { 704 | width: calc(100% - 200px); 705 | margin: 0 0 10px 200px; 706 | } 707 | } 708 | 709 | article.rapido > header > address > img { 710 | display: inline-block; 711 | width: 50px; 712 | height: 50px; 713 | margin-right: 5px; 714 | vertical-align: middle; 715 | border-radius: 25px; 716 | } 717 | 718 | /* end img, video */ 719 | 720 | /* table */ 721 | 722 | article.rapido table { 723 | min-width: 600px; 724 | padding: 10px; 725 | border-collapse: collapse; 726 | border-top: 1px solid #ededed; 727 | border-left: 1px solid #ededed; 728 | text-align: left; 729 | font-family: inherit; 730 | font-size: 14px; 731 | line-height: 21px; 732 | } 733 | 734 | article.rapido table thead { 735 | background-color: #f4f4f4; 736 | } 737 | 738 | article.rapido table td, 739 | article.rapido table th { 740 | padding: 5px 10px; 741 | vertical-align: top; 742 | } 743 | 744 | article.rapido table tr { 745 | border-bottom: 1px solid #ededed; 746 | } 747 | 748 | article.rapido table th { 749 | border-right: 1px solid #e0e0e0; 750 | } 751 | 752 | article.rapido table td, 753 | article.rapido table th:last-child { 754 | border-right: 1px solid #ededed; 755 | } 756 | 757 | /* end table */ 758 | 759 | /* KaTex */ 760 | 761 | article.rapido .katex-display { 762 | padding: 10px 0 !important; 763 | } 764 | 765 | /* end KaTex */ 766 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Rapido 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 |
30 |
31 |

Rapido.css: semantic HTML for your writings.

32 |

Rapido provides a default style for a set of semantic HTML elements that you can use to compose your essays. Just write with semantic HTML, without the need to remember any CSS class or JS command.

33 |

The present document has been created using Rapido, you can easily get documents or blog posts with the same layout and style. See how to use Rapido in the next sections.

34 |
35 |
<article class="rapido">
 36 |   <section>
 37 |     <h1>...</h1>
 38 |     <p>...<small>...</small></p>
 39 |   </section>
 40 | </article>
41 |
42 |

Assign the CSS class rapido to the <article> element and you are done.

43 |

Rapido is just that: copy the HTML snippets and fill the gaps.

44 |
45 |
46 |

Rapido is open source, view it on Github.

47 |
48 |
49 |

Motivation

50 |

Having your own corner on the web where you can freely share thoughts or technical stuff is still cool, and the popularity of tools like Jekyll or Gatsby proves that. Rapido intervenes there, offering semantic HTML templates for a variety of typical author needs: like header, sections, side notes, references and so on.The importance of using semantic HTML is a common theme in web development, it is a good idea to use the relevant HTML element for the job. Semantic HTML improves the usability of the code and ensures maximum accessibility.

51 |

Rapido has been crafted with the idea that using semantic HTML for your writings can be easy. For such a reason Rapido does not make use of CSS classes or Javascript hooks, the author can compose all the different parts of the document with semantic HTML elements, for example adding side notes in paragraphs with the <small> element.

52 |
53 |
54 |

Getting started

55 |

Rapido provides style rules in the rapido.css stylesheet, you can see the latest version of the CSS file in Github. Use rapido.css linking to it within the <head> element in your document.

56 |
57 |
<head>
 58 |   <link href="https://unpkg.com/@nextbitlabs/rapido@^3/rapido.css" rel="stylesheet" type="text/css">
 59 | </head>
60 |
61 |

Link to rapido.css in unpkg. Rapido uses semantic versioning, the example fetches the major release 3.x.

62 |
63 |
64 |

The style rules defined in rapido.css are name-spaced under the CSS class rapido. Being Rapido thought for web essays, the place to use the CSS class is the <article> element, as showed in the next snippet.

65 |
66 |
<main>
 67 |   <article class="rapido">
 68 |     ...
 69 |   </article>
 70 | </main>
71 |
72 |

Assign CSS class rapido to the <article> element.

73 |

Rapido can be used in a web document created from scratch or within an existing document, the CSS class rapido makes Rapido not invasive with respect to existing CSS code.

74 |
75 |
76 |

Install with npm

77 |

Alternatively, you may want to install Rapido using npm. This is especially useful when you want to add Rapido as a dependency of your application.

78 |
 79 | npm install @nextbitlabs/rapido
 80 | 
81 |

Get your hands dirty

82 |

If you want to try Rapido then you need the skeleton of an HTML document. The next code snippet provides a minimal template, copy the snippet in a fresh HTML file.

83 |
84 |
<!DOCTYPE html>
 85 | <html>
 86 |   <head>
 87 |     <meta charset="utf-8">
 88 |     <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, user-scalable=yes">
 89 |     <link href="https://unpkg.com/@nextbitlabs/rapido@^3/rapido.css" rel="stylesheet" type="text/css">
 90 |   </head>
 91 |   <body>
 92 |     <main>
 93 |       <article class="rapido">
 94 |         ...
 95 |       </article>
 96 |     </main>
 97 |   </body>
 98 | </html>
99 |
100 |

Minimal skeleton of an HTML document.

101 |

Note the presence of the stylesheet rapido.css within the <head> element, it defines the style rules and it is all you need to use Rapido.

102 |
103 |
104 |

The next sections describe how to replace the ellipsis with the content of interest, like paragraphs, figures, tables and so on.

105 |
106 | 107 |
108 |

Sections

109 |

The previous code snippet shows a gap within the <article> element, you can fill the gap with sections. Typically, sections have a heading and one or more paragraphs. Moreover, sections may also contain figures, tables and much more.

110 |
111 |
<main>
112 |   <article>
113 |     <section>
114 |       <h1>...</h1>
115 |       <p>...</p>
116 |       <p>...</p>
117 |       <h2>...</h2>
118 |       <p>...</p>
119 |     </section>
120 |   </article>
121 | </main>
122 |
123 |

Code snippet of a section.

124 |

The example shows a section with a heading and two paragraphs, a lower level heading and another paragraph.

125 |
126 |
127 |

The code snippet above shows an example of implicit sectioning, where both the <h1> and <h2> elements are in the same section. Authors are encouraged to explicitly wrap sections in elements of sectioning content, instead of relying on the implicit sections generated by having multiple headings in one <section> element.

128 |
129 |
<main>
130 |   <article>
131 |     <section>
132 |       <h1>...</h1>
133 |       ...
134 |       <section>
135 |         <h2>...</h2>
136 |         ...
137 |         <section>
138 |           <h3>...</h3>
139 |           ...
140 |         </section>
141 |       </section>
142 |     </section>
143 |   </article>
144 | </main>
145 |
146 |

Explicit sectioning.

147 |

Sections in HTML5 can be nested, use headings of the appropriate rank for the section's nesting level. Explicit sectioning allows for predictable document outlines and better user experience.

148 |
149 |
150 |
151 | 152 |
153 |

Title and abstract

154 |

The <header> element is used for the title and few introductory paragraphs of your document. Generally, it is placed as the first element within the <article> element.

155 |
156 |
<main>
157 |   <article>
158 |     <header>
159 |       <h1>...</h1>
160 |       <p>...</p>
161 |       <p>...</p>
162 |       <address>
163 |         <img src="...">
164 |         ...
165 |         <a href="...">...</a>
166 |       </address>
167 |     </header>
168 |     ...
169 |   </article>
170 | </main>
171 |
172 |

Code snippet for the document header.

173 |

The element <address> can be used to indicate the contact information of the authors. The element <img> is useful for adding the author avatar.

174 |
175 |
176 |

The header may also contain full-width images, as described in section Images and videos.

177 |
178 | 179 |
180 |

Side comments

181 |

This section describes how to add a side comment. Side comments typically show parenthetical content considered part of the main flow, like qualifying remarks directly related to the section.Side comments are related to the paragraph, therefore they usually appear right or below the text of the paragraph.

182 |

A side comment should be inserted within the paragraph of a section, it will appear at the right of the paragraph and vertically aligned with it, or just below the paragraph on smaller screens.

183 |
184 |
<section>
185 |   <h1>...</h1>
186 |   <p>
187 |     ...
188 |     <small>...<img src="...">...</small>
189 |     ...
190 |   </p>
191 | </section>
192 |
193 |

Code snippet of a side comment.

194 |

Side comments may also contain pictures, added by means of the <img> element.

195 |
196 |
197 |
198 | 199 |
200 |

Images and videos

201 |

Images and videos are displayed using the <img> and <video> elements. If a caption is needed, wrap images and videos within the <figure> element and use the <figcaption> element for the caption, as shown in the code snippet below. The <figcaption> element can contain a heading and one or more paragraphs.

202 |
203 | 204 |
205 |

Artwork based on Perlin noise, written in GLSL.

206 |
207 |
208 |
209 |
<section>
210 |   <h1>...</h1>
211 |   <p>...</p>
212 |   <figure>
213 |     <img src="image.jpg">
214 |     <figcaption>
215 |       <h1>...</h1>
216 |       <p>...</p>
217 |     </figcaption>
218 |   </figure>
219 |   <p>...</p>
220 | </section>
221 |
222 |

Code snippet of an image, with a descriptive caption.

223 |

The <figure> element may be avoided if there is no need for a caption, in such a case the <img> element is a child of the <section> element. The default width of images is 600px, equals to the default width of text paragraph and code snippets. Authors can use inline style declarations to customise the width, as described in section Customisations.

224 |
225 |
226 |

Videos

227 |

Exactly the same HTML code snippet is used for displaying videos, with the obvious difference of using the <video> element in place of the <img> element, as shown below.

228 |
229 |
<section>
230 |   <h1>...</h1>
231 |   <p>...</p>
232 |   <figure>
233 |     <video controls muted src="video.mp4"></video>
234 |     <figcaption>
235 |       <h1>...</h1>
236 |       <p>...</p>
237 |     </figcaption>
238 |   </figure>
239 |   <p>...</p>
240 | </section>
241 |
242 |

Code snippet of a video with a caption.

243 |

As with images, videos have a default width of 600 pixels, customisable with inline declarations as described in section Customisations.

244 |
245 |
246 |
247 | 248 |
249 |

Quotations

250 |

This section shows how to add quotations from another source into your document. The <blockquote> element can be inserted in a section within other paragraphs and may contain one or more paragraphs as well.

251 |
252 |

Content inside a blockquote must be quoted from another source, whose address, if it has one, may be cited in the cite attribute.

253 |
254 | HTML Living Standard 255 |
256 |
<section>
257 |   <h1>...</h1>
258 |   <p>...</p>
259 |   <blockquote cite="https://...">
260 |     <p>...</p>
261 |   </blockquote>
262 |   <cite>...</cite>
263 |   <p>...</p>
264 | </section>
265 |
266 |

Code snippet of a quotation from another source.

267 |

If appropriate, use the cite attribute for adding a URL of the quotation source and the <cite> element for the text representation.

268 |
269 |
270 |
271 | 272 |
273 |

Highlights

274 |

The repetition of some content from the same source is used for the purposes of enticing readers or highlighting key topics. You can repeat a passage or an entire paragraph using the <aside> element inside a section.

275 | 278 |
279 |
<section>
280 |   <h1>...</h1>
281 |   <p>...</p>
282 |   <aside>
283 |     <p>...</p>
284 |   </aside>
285 |   <p>...</p>
286 | </section>
287 |
288 |

Code snippet of an highlight.

289 |

Highlights are styled with a font bigger than the surrounding text.

290 |
291 |
292 |
293 | 294 |
295 |

Tables

296 |

As well as with images and videos, tables are displayed within the <figure> element, with an optional caption. Tables are useful for displaying tabular data with few or several columns, if the table is bigger than the window width the hidden part is visible through mouse scrolling.

297 |
298 |
299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 |
TagMeaningDescription
<em>emphasisUse it for adding emphasis to a word, compared to surrounding text. Example: "We had to do something about it."
<strong>importanceUse it to mark text that has greater importance than surrounding text. Example: "Warning! This is very dangerous."
<mark>relevanceUse it to denote content which has a degree of relevance, for example highlighting search results or code fragments.
325 |
326 |
327 |

We take the opportunity of this example to describe the semantic meaning of elements <em>, <strong> and <mark>. Examples are taken from the MDN web docs.

328 |
329 |
330 |
331 |
<section>
332 |   <h1>...</h1>
333 |   <p>...</p>
334 |   <figure>
335 |     <div>
336 |       <table>
337 |         <thead>
338 |           <tr>
339 |             <th>...</th>
340 |             <th>...</th>
341 |           </tr>
342 |         </thead>
343 |         <tbody>
344 |           <tr>
345 |             <td>...</td>
346 |             <td>...</td>
347 |           </tr>
348 |           <tr>
349 |             <td>...</td>
350 |             <td>...</td>
351 |           </tr>
352 |         </tbody>
353 |       </table>
354 |     </div>
355 |   </figure>
356 |   <p>...</p>
357 | </section>
358 |
359 |

Code snippet of a table.

360 |

The <thead> element defines the head of the table columns, instead, the <tbody> element is used for the table body. Note that, differently from images and videos, there is an extra <div> container wrapping the <table> element. The default width is 600px, authors can use inline style declarations to customise the table width, as described in section Customisations.

361 |
362 |
363 |
364 | 365 |
366 |

Lists

367 |

Lists are created with the <ul> and <ol> elements, whereas <li> element is used to represent list items.

368 |
    369 |
  • 370 |

    use the <ol> element for ordered lists

    371 |
  • 372 |
  • 373 |

    use the <ul> element for unordered lists

    374 |
  • 375 |
376 |
377 |
<section>
378 |   <h1>...</h1>
379 |   <p>...</p>
380 |   <ul>
381 |     <li>
382 |       <p>...</p>
383 |     </li>
384 |     <li>
385 |       <p>...</p>
386 |     </li>
387 |   </ul>
388 |   <p>...</p>
389 | </section>
390 |
391 |

Code snippet of code list.

392 |

Use the <ol> element when the order is meaningful, ordered list are rendered as a numbered list:

393 |
    394 |
  1. first item

  2. 395 |
  3. second item

  4. 396 |
397 |
398 |
399 |
400 | 401 |
402 |

Code

403 |

Listings of code can be inserted inline inside a paragraph or within element <figure> for multiple lines of code.

404 |
405 |
<p>...<code>...</code>...</p>
406 |
407 |

Code snippet of code listings.

408 |

Add inline code using the <code> element.

409 |
410 |
411 |
412 |
<figure>
413 |   <pre><code>...</code></pre>
414 | </figure>
415 |
416 |

Wrap the <code> element within the <pre> element to add multiple lines of code.

417 |
418 |
419 |

As with images, videos and tables, the default width is 600px. You can use inline declarations to customise the width, for example setting 100% width with <pre style="width: 100%">. See section Customisations for more details.

420 |

Example 1

421 |
422 |
const f = n => n ? n * f(n - 1) : 1;
423 |
424 |

Factorial function in Javascript.

425 |
426 |
427 |

The next code snippet shows how to write the factorial function above.

428 |
429 |
<figure>
430 |   <pre><code>const f = n => n ? n * f(n - 1) : 1;</code></pre>
431 | </figure>
432 |
433 |

Listing 1

434 |
435 |
436 |

Example 2

437 |

This example shows how to obtain the expected indentation with more lines of code. As rule of thumb, paste the code directly within the <pre><code>...</code></pre> elements.

438 |
439 |
function factorial (n) {
440 |   return n ? n * factorial(n - 1) : 1;
441 | }
442 |
443 |
444 |
<figure>
445 |   <pre><code>function factorial (n) {
446 |   return n ? n * factorial(n - 1) : 1;
447 | }</code></pre>
448 | </figure>
449 |
450 |

Example 3

451 |

A special treatment is necessary for HTML code because it needs to be escaped: use string &lt; for < and string &gt; for >.

452 |
453 |
<figure>
454 |   <pre><code>&lt;figure&gt;
455 |   &lt;pre&gt;&lt;code&gt;const f = n => n ? n * f(n - 1) : 1;&lt;/code&gt;&lt;/pre&gt;
456 | &lt;/figure&gt;</code></pre>
457 | </figure>
458 |
459 |

Snippet used for the HTML code of listing 1.

460 |
461 |
462 |

Highlight code

463 |

You can highlight code in two different ways: inline or full lines.

464 |
465 |
<figure>
466 |   <pre><code>...<mark>...</mark>...</code></pre>
467 | </figure>
468 |
469 |

Highlight a portion of a line.

470 |

Wrap the relevant code within the <mark> element.

471 |
472 |
473 |

Instead, highlight one or more lines of code wrapping the full line within the <mark> element, the next snippet shows an example.

474 |
475 |
<figure>
476 |   <pre><code>...</code>
477 | <mark><code>...</code></mark>
478 | <code>...</code></pre>
479 | </figure>
480 |
481 |

Highlight full lines of code.

482 |

Note that, within the <pre> element, indentation spaces and new lines deserve special attention in order to represent the right code formatting.

483 |
484 |
485 |
486 | 487 |
488 |

Math formulas

489 |

Math typesetting is not supported by default. We suggest using KaTeX, a popular JavaScript library for TeX math rendering on the web. To get KaTex working, copy and paste the next code within the <head> element (see section Getting Started).

490 |
491 |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.10.0-rc.1/dist/katex.min.css" integrity="sha384-D+9gmBxUQogRLqvARvNLmA9hS2x//eK1FhVb9PiU86gmcrBrJAQT8okdJ4LMp2uv" crossorigin="anonymous">
492 | <script defer src="https://cdn.jsdelivr.net/npm/katex@0.10.0-rc.1/dist/katex.min.js" integrity="sha384-483A6DwYfKeDa0Q52fJmxFXkcPCFfnXMoXblOkJ4JcA8zATN6Tm78UNL72AKk+0O" crossorigin="anonymous"></script>
493 | <script defer src="https://cdn.jsdelivr.net/npm/katex@0.10.0-rc.1/dist/contrib/auto-render.min.js" integrity="sha384-yACMu8JWxKzSp/C1YV86pzGiQ/l1YUfE8oPuahJQxzehAjEt2GiQuy/BIvl9KyeF" crossorigin="anonymous" onload="renderMathInElement(document.body,{delimiters: [{left: '$$', right: '$$', display: true},{left: '$', right: '$', display: false}]});"></script>
494 |
495 |

Example 1

496 |

You can insert mathematics inline on a paragraph, like the famous equivalence between energy and inertial mass $E = mc^2$, surrounding the mathematical formula with symbols $...$, as presented below.

497 |
498 |
<p>... $E = mc^2$ ...</p>
499 |
500 |

Inline formula.

501 |
502 |
503 |

Example 2

504 |

Having your formula in a new line is easy as well, just use $$...$$ instead of $...$.

505 |

$$G_{\mu\nu} + \Lambda g_{\mu\nu} = \frac{8\pi G}{c^4}T_{\mu\nu}$$Einstein field equations [1], expressed for the first time 8 years later the the happiest thought of my life [2].

506 |
507 |
<p>
508 |   ...
509 |   $$G_{\mu\nu} + \Lambda g_{\mu\nu} = \frac{8\pi G}{c^4}T_{\mu\nu}$$
510 |   ...
511 | </p>
512 |
513 |

Example 3

514 |

KaTeX supports a wide list of TeX functions. For example, for the representation of the following system of equations, we make use of the \begin{array} environment.

515 |
516 |

517 | $$\begin{array}{rcl} 518 | \nabla \cdot \mathbf{E} & = & 0 \\\\ 519 | \nabla \cdot \mathbf{B} & = & 0 \\\\ 520 | \nabla \times \mathbf{E} & = & - \displaystyle\frac{1}{c} \displaystyle\frac{\partial \mathbf{B}}{\partial t} \\\\ 521 | \nabla \times \mathbf{B} & = & \displaystyle\frac{1}{c} \displaystyle\frac{\partial \mathbf{E}}{\partial t} 522 | \end{array}$$ 523 |

524 |
525 |

Maxwell's equations in vacuum.

526 |

The equations can be reduced to the standard wave equation $$ 527 | \frac{1}{c^2} \frac{\partial^2 \mathbf{F}}{\partial^2 t} - \nabla^2 \mathbf{F} = 0 528 | $$ providing the theoretical background for the electromagnetic waves [3].

529 |
530 |
531 |
532 |
<figure>
533 |   <p>
534 |     $$\begin{array}{rcl}
535 |       \nabla \cdot \mathbf{E} & = & 0 \\\\
536 |       \nabla \cdot \mathbf{B} & = & 0 \\\\
537 |       \nabla \times \mathbf{E} & = & - \displaystyle\frac{1}{c} \displaystyle\frac{\partial \mathbf{B}}{\partial t} \\\\
538 |       \nabla \times \mathbf{B} & = & \displaystyle\frac{1}{c} \displaystyle\frac{\partial \mathbf{E}}{\partial t}
539 |     \end{array}$$
540 |   </p>
541 | </figure>
542 |
543 |

Use TeX functions for more sophisticated math typesetting. Use the <figure> element if a caption is needed. The default width of the <p> element within the <figure> element is 600px. Authors can use inline style declarations to customise the width for larger formulas, as described in section Customisations.

544 |
545 |
546 |
547 | 548 |
549 |

Customisations

550 |

Rapido focuses on semantic HTML, providing a default style for a variety of HTML elements. Being CSS classes out of scope, authors looking for a different style must opt for a customisation.Rapido does not expose CSS classes. This design choice makes Rapido easier to use and, due to how specificity works, easier to extend with custom CSS classes.

551 |

You may change the default CSS rules or write new rules that have precedence over the default ones. As usual, this is possible both with inline declarations and stylesheets. The following examples show some common customisations. 552 |

553 |
554 |
<head>
555 |   ...
556 |   <style>
557 |     article.rapido {
558 |       font-family: "Helvetica Neue";
559 |     }
560 |     article.rapido code {
561 |       font-family: "Iosevka";
562 |     }
563 |   </style>
564 | </head>
565 |
566 |

Font families.

567 |

You can easily change the default font families, both for code and normal text.

568 |
569 |
570 |
571 |
<head>
572 |   ...
573 |   <style>
574 |     article.rapido code {
575 |       color: rgba(0, 0, 255, 1);
576 |     }
577 |     article.rapido pre > mark > code {
578 |       border-left: 2px solid rgba(0, 0, 255, 1);
579 |       background: rgba(0, 0, 255, 0.05);
580 |     }
581 |     article.rapido mark {
582 |       background: rgba(0, 0, 255, 0.1);
583 |     }
584 |   </style>
585 | </head>
586 |
587 |

Font colour on code snippets.

588 |

The default colour is blue, authors are encouraged to choose the colour that better adapts to the pre-existing style if any.

589 |
590 |
591 |
592 |
<figure>
593 |   <img src="..." style="width: 100%">
594 |   ...
595 | </figure>
596 |
597 |

Full-width images, videos, tables and code snippets.

598 |

The default width is 600 pixels, you can assign to an image a bigger or smaller width than the default one. Full width equals to 944 pixels.

599 |
600 |
601 |
602 |
<head>
603 |   ...
604 |   <style>
605 |     .rapido .full-width {
606 |       width: 100%;
607 |     }
608 |   </style>
609 | </head>
610 |
611 |

Full-width images can be obtained also defining an apposite CSS class, which can be used with <img src="..." class="full-width">. On the same way it can be used with videos (<video>), code snippets (<pre>) and tables (<div>).

612 |
613 |
614 |
615 | 616 | 660 |
661 |
662 | 663 | 664 | --------------------------------------------------------------------------------