2391 lines
97 KiB
HTML
2391 lines
97 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<link rel="canonical" href="https://thepaciellogroup.github.io/cupper/print-version/">
|
|
<link rel="apple-touch-icon" sizes="57x57" href="https://thepaciellogroup.github.io/cupper/images/apple-touch-icon-57x57.png">
|
|
<link rel="apple-touch-icon" sizes="60x60" href="https://thepaciellogroup.github.io/cupper/images/apple-touch-icon-60x60.png">
|
|
<link rel="apple-touch-icon" sizes="72x72" href="https://thepaciellogroup.github.io/cupper/images/apple-touch-icon-72x72.png">
|
|
<link rel="apple-touch-icon" sizes="76x76" href="https://thepaciellogroup.github.io/cupper/images/apple-touch-icon-76x76.png">
|
|
<link rel="apple-touch-icon" sizes="114x114" href="https://thepaciellogroup.github.io/cupper/images/apple-touch-icon-114x114.png">
|
|
<link rel="apple-touch-icon" sizes="120x120" href="https://thepaciellogroup.github.io/cupper/images/apple-touch-icon-120x120.png">
|
|
<link rel="apple-touch-icon" sizes="144x144" href="https://thepaciellogroup.github.io/cupper/images/apple-touch-icon-144x144.png">
|
|
<link rel="apple-touch-icon" sizes="152x152" href="https://thepaciellogroup.github.io/cupper/images/apple-touch-icon-152x152.png">
|
|
<link rel="apple-touch-icon" sizes="180x180" href="https://thepaciellogroup.github.io/cupper/images/apple-touch-icon-180x180.png">
|
|
<link rel="icon" type="image/png" sizes="192x192" href="https://thepaciellogroup.github.io/cupper/images/android-icon-192x192.png">
|
|
<link rel="icon" type="image/png" sizes="32x32" href="https://thepaciellogroup.github.io/cupper/images/favicon-32x32.png">
|
|
<link rel="icon" type="image/png" sizes="96x96" href="https://thepaciellogroup.github.io/cupper/images/favicon-96x96.png">
|
|
<link rel="icon" type="image/png" sizes="16x16" href="https://thepaciellogroup.github.io/cupper/images/favicon-16x16.png">
|
|
<meta name="msapplication-TileColor" content="#ffffff">
|
|
<meta name="msapplication-TileImage" content="https://thepaciellogroup.github.io/cupper/images/ms-icon-144x144.png">
|
|
<meta name="theme-color" content="#ffffff">
|
|
<link href="https://fonts.googleapis.com/css?family=PT+Sans:400,400i,700" rel="stylesheet" media="none" onload="this.media='all';">
|
|
<link rel="stylesheet" href="https://thepaciellogroup.github.io/cupper/css/prism.css" media="none" onload="this.media='all';">
|
|
<link rel="stylesheet" type="text/css" href="https://thepaciellogroup.github.io/cupper/css/styles.css">
|
|
<style id="inverter" media="none">
|
|
html { filter: invert(100%) }
|
|
* { background-color: inherit }
|
|
img:not([src*=".svg"]), .colors, iframe, .demo-container { filter: invert(100%) }
|
|
</style>
|
|
<title>
|
|
|
|
Cupper
|
|
|
|
</title>
|
|
|
|
</head>
|
|
<body>
|
|
|
|
<svg style="display: none">
|
|
<symbol id="bookmark" viewBox="0 0 40 50">
|
|
<g transform="translate(2266 3206.2)">
|
|
<path style="stroke:currentColor;stroke-width:3.2637;fill:none" d="m-2262.2-3203.4-.2331 42.195 16.319-16.318 16.318 16.318.2331-42.428z"/>
|
|
</g>
|
|
</symbol>
|
|
|
|
<symbol id="w3c" viewBox="0 0 127.09899 67.763">
|
|
<text font-size="83" style="font-size:83px;font-family:Trebuchet;letter-spacing:-12;fill-opacity:0" letter-spacing="-12" y="67.609352" x="-26.782778">W3C</text>
|
|
<text font-size="83" style="font-size:83px;font-weight:bold;font-family:Trebuchet;fill-opacity:0" y="67.609352" x="153.21722" font-weight="bold">SVG</text>
|
|
<path style="fill:currentColor;image-rendering:optimizeQuality;shape-rendering:geometricPrecision" d="m33.695.377 12.062 41.016 12.067-41.016h8.731l-19.968 67.386h-.831l-12.48-41.759-12.479 41.759h-.832l-19.965-67.386h8.736l12.061 41.016 8.154-27.618-3.993-13.397h8.737z"/>
|
|
<path style="fill:currentColor;image-rendering:optimizeQuality;shape-rendering:geometricPrecision" d="m91.355 46.132c0 6.104-1.624 11.234-4.862 15.394-3.248 4.158-7.45 6.237-12.607 6.237-3.882 0-7.263-1.238-10.148-3.702-2.885-2.47-5.02-5.812-6.406-10.022l6.82-2.829c1.001 2.552 2.317 4.562 3.953 6.028 1.636 1.469 3.56 2.207 5.781 2.207 2.329 0 4.3-1.306 5.909-3.911 1.609-2.606 2.411-5.738 2.411-9.401 0-4.049-.861-7.179-2.582-9.399-1.995-2.604-5.129-3.912-9.397-3.912h-3.327v-3.991l11.646-20.133h-14.062l-3.911 6.655h-2.493v-14.976h32.441v4.075l-12.31 21.217c4.324 1.385 7.596 3.911 9.815 7.571 2.22 3.659 3.329 7.953 3.329 12.892z"/>
|
|
<path style="fill:currentColor;image-rendering:optimizeQuality;shape-rendering:geometricPrecision" d="m125.21 0 1.414 8.6-5.008 9.583s-1.924-4.064-5.117-6.314c-2.693-1.899-4.447-2.309-7.186-1.746-3.527.73-7.516 4.938-9.258 10.13-2.084 6.21-2.104 9.218-2.178 11.978-.115 4.428.58 7.043.58 7.043s-3.04-5.626-3.011-13.866c.018-5.882.947-11.218 3.666-16.479 2.404-4.627 5.954-7.404 9.114-7.728 3.264-.343 5.848 1.229 7.841 2.938 2.089 1.788 4.213 5.698 4.213 5.698l4.94-9.837z"/>
|
|
<path style="fill:currentColor;image-rendering:optimizeQuality;shape-rendering:geometricPrecision" d="m125.82 48.674s-2.208 3.957-3.589 5.48c-1.379 1.524-3.849 4.209-6.896 5.555-3.049 1.343-4.646 1.598-7.661 1.306-3.01-.29-5.807-2.032-6.786-2.764-.979-.722-3.486-2.864-4.897-4.854-1.42-2-3.634-5.995-3.634-5.995s1.233 4.001 2.007 5.699c.442.977 1.81 3.965 3.749 6.572 1.805 2.425 5.315 6.604 10.652 7.545 5.336.945 9.002-1.449 9.907-2.031.907-.578 2.819-2.178 4.032-3.475 1.264-1.351 2.459-3.079 3.116-4.108.487-.758 1.276-2.286 1.276-2.286l-1.276-6.644z"/>
|
|
</symbol>
|
|
|
|
<symbol id="tag" viewBox="0 0 177.16535 177.16535">
|
|
<g transform="translate(0 -875.2)">
|
|
<path style="fill-rule:evenodd;stroke-width:0;fill:currentColor" d="m159.9 894.3-68.79 8.5872-75.42 77.336 61.931 60.397 75.429-76.565 6.8495-69.755zm-31.412 31.835a10.813 10.813 0 0 1 1.8443 2.247 10.813 10.813 0 0 1 -3.5174 14.872l-.0445.0275a10.813 10.813 0 0 1 -14.86 -3.5714 10.813 10.813 0 0 1 3.5563 -14.863 10.813 10.813 0 0 1 13.022 1.2884z"/>
|
|
</g>
|
|
</symbol>
|
|
|
|
<symbol id="balloon" viewBox="0 0 141.73228 177.16535">
|
|
<g transform="translate(0 -875.2)">
|
|
<g>
|
|
<path style="fill:currentColor" d="m68.156 882.83-.88753 1.4269c-4.9564 7.9666-6.3764 17.321-5.6731 37.378.36584 10.437 1.1246 23.51 1.6874 29.062.38895 3.8372 3.8278 32.454 4.6105 38.459 4.6694-.24176 9.2946.2879 14.377 1.481 1.2359-3.2937 5.2496-13.088 8.886-21.623 6.249-14.668 8.4128-21.264 10.253-31.252 1.2464-6.7626 1.6341-12.156 1.4204-19.764-.36325-12.93-2.1234-19.487-6.9377-25.843-2.0833-2.7507-6.9865-7.6112-7.9127-7.8436-.79716-.20019-6.6946-1.0922-6.7755-1.0248-.02213.0182-5.0006-.41858-7.5248-.22808l-2.149-.22808h-3.3738z"/>
|
|
<path style="fill:currentColor" d="m61.915 883.28-3.2484.4497c-1.7863.24724-3.5182.53481-3.8494.63994-2.4751.33811-4.7267.86957-6.7777 1.5696-.28598 0-1.0254.20146-2.3695.58589-5.0418 1.4418-6.6374 2.2604-8.2567 4.2364-6.281 7.6657-11.457 18.43-12.932 26.891-1.4667 8.4111.71353 22.583 5.0764 32.996 3.8064 9.0852 13.569 25.149 22.801 37.517 1.3741 1.841 2.1708 2.9286 2.4712 3.5792 3.5437-1.1699 6.8496-1.9336 10.082-2.3263-1.3569-5.7831-4.6968-21.86-6.8361-33.002-.92884-4.8368-2.4692-14.322-3.2452-19.991-.68557-5.0083-.77707-6.9534-.74159-15.791.04316-10.803.41822-16.162 1.5026-21.503 1.4593-5.9026 3.3494-11.077 6.3247-15.852z"/>
|
|
<path style="fill:currentColor" d="m94.499 885.78c-.10214-.0109-.13691 0-.0907.0409.16033.13489 1.329 1.0675 2.5976 2.0723 6.7003 5.307 11.273 14.568 12.658 25.638.52519 4.1949.24765 14.361-.5059 18.523-2.4775 13.684-9.7807 32.345-20.944 53.519l-3.0559 5.7971c2.8082.76579 5.7915 1.727 8.9926 2.8441 11.562-11.691 18.349-19.678 24.129-28.394 7.8992-11.913 11.132-20.234 12.24-31.518.98442-10.02-1.5579-20.876-6.7799-28.959-.2758-.4269-.57803-.86856-.89617-1.3166-3.247-6.13-9.752-12.053-21.264-16.131-2.3687-.86369-6.3657-2.0433-7.0802-2.1166z"/>
|
|
<path style="fill:currentColor" d="m32.52 892.22c-.20090-.13016-1.4606.81389-3.9132 2.7457-11.486 9.0476-17.632 24.186-16.078 39.61.79699 7.9138 2.4066 13.505 5.9184 20.562 5.8577 11.77 14.749 23.219 30.087 38.74.05838.059.12188.1244.18052.1838 1.3166-.5556 2.5965-1.0618 3.8429-1.5199-.66408-.32448-1.4608-1.3297-3.8116-4.4602-5.0951-6.785-8.7512-11.962-13.051-18.486-5.1379-7.7948-5.0097-7.5894-8.0586-13.054-6.2097-11.13-8.2674-17.725-8.6014-27.563-.21552-6.3494.13041-9.2733 1.775-14.987 2.1832-7.5849 3.9273-10.986 9.2693-18.07 1.7839-2.3656 2.6418-3.57 2.4409-3.7003z"/>
|
|
<path style="fill:currentColor" d="m69.133 992.37c-6.2405.0309-12.635.76718-19.554 2.5706 4.6956 4.7759 9.935 10.258 12.05 12.625l4.1272 4.6202h11.493l3.964-4.4516c2.0962-2.3541 7.4804-7.9845 12.201-12.768-8.378-1.4975-16.207-2.6353-24.281-2.5955z"/>
|
|
<rect style="stroke-width:0;fill:currentColor" ry="2.0328" height="27.746" width="22.766" y="1017.7" x="60.201"/>
|
|
</g>
|
|
</g>
|
|
</symbol>
|
|
|
|
<symbol id="info" viewBox="0 0 41.667 41.667">
|
|
<g transform="translate(-37.035 -1004.6)">
|
|
<path style="stroke-linejoin:round;stroke:currentColor;stroke-linecap:round;stroke-width:3.728;fill:none" d="m76.25 1030.2a18.968 18.968 0 0 1 -23.037 13.709 18.968 18.968 0 0 1 -13.738 -23.019 18.968 18.968 0 0 1 23.001 -13.768 18.968 18.968 0 0 1 13.798 22.984"/>
|
|
<g transform="matrix(1.1146 0 0 1.1146 -26.276 -124.92)">
|
|
<path style="stroke:currentColor;stroke-linecap:round;stroke-width:3.728;fill:none" d="m75.491 1039.5v-8.7472"/>
|
|
<path style="stroke-width:0;fill:currentColor" transform="scale(-1)" d="m-73.193-1024.5a2.3719 2.3719 0 0 1 -2.8807 1.7142 2.3719 2.3719 0 0 1 -1.718 -2.8785 2.3719 2.3719 0 0 1 2.8763 -1.7217 2.3719 2.3719 0 0 1 1.7254 2.8741"/>
|
|
</g>
|
|
</g>
|
|
</symbol>
|
|
|
|
<symbol id="warning" viewBox="0 0 48.430474 41.646302">
|
|
<g transform="translate(-1.1273 -1010.2)">
|
|
<path style="stroke-linejoin:round;stroke:currentColor;stroke-linecap:round;stroke-width:4.151;fill:none" d="m25.343 1012.3-22.14 37.496h44.28z"/>
|
|
<path style="stroke:currentColor;stroke-linecap:round;stroke-width:4.1512;fill:none" d="m25.54 1027.7v8.7472"/>
|
|
<path style="stroke-width:0;fill:currentColor" d="m27.839 1042.8a2.3719 2.3719 0 0 1 -2.8807 1.7143 2.3719 2.3719 0 0 1 -1.718 -2.8785 2.3719 2.3719 0 0 1 2.8763 -1.7217 2.3719 2.3719 0 0 1 1.7254 2.8741"/>
|
|
</g>
|
|
</symbol>
|
|
|
|
<symbol id="menu" viewBox="0 0 50 50">
|
|
<rect style="stroke-width:0;fill:currentColor" height="10" width="50" y="0" x="0"/>
|
|
<rect style="stroke-width:0;fill:currentColor" height="10" width="50" y="20" x="0"/>
|
|
<rect style="stroke-width:0;fill:currentColor" height="10" width="50" y="40" x="0"/>
|
|
</symbol>
|
|
|
|
<symbol id="link" viewBox="0 0 50 50">
|
|
<g transform="translate(0 -1002.4)">
|
|
<g transform="matrix(.095670 0 0 .095670 2.3233 1004.9)">
|
|
<g>
|
|
<path style="stroke-width:0;fill:currentColor" d="m452.84 192.9-128.65 128.65c-35.535 35.54-93.108 35.54-128.65 0l-42.881-42.886 42.881-42.876 42.884 42.876c11.845 11.822 31.064 11.846 42.886 0l128.64-128.64c11.816-11.831 11.816-31.066 0-42.9l-42.881-42.881c-11.822-11.814-31.064-11.814-42.887 0l-45.928 45.936c-21.292-12.531-45.491-17.905-69.449-16.291l72.501-72.526c35.535-35.521 93.136-35.521 128.64 0l42.886 42.881c35.535 35.523 35.535 93.141-.001 128.66zm-254.28 168.51-45.903 45.9c-11.845 11.846-31.064 11.817-42.881 0l-42.884-42.881c-11.845-11.821-11.845-31.041 0-42.886l128.65-128.65c11.819-11.814 31.069-11.814 42.884 0l42.886 42.886 42.876-42.886-42.876-42.881c-35.54-35.521-93.113-35.521-128.65 0l-128.65 128.64c-35.538 35.545-35.538 93.146 0 128.65l42.883 42.882c35.51 35.54 93.11 35.54 128.65 0l72.496-72.499c-23.956 1.597-48.092-3.784-69.474-16.283z"/>
|
|
</g>
|
|
</g>
|
|
</g>
|
|
</symbol>
|
|
|
|
<symbol id="doc" viewBox="0 0 35 45">
|
|
<g transform="translate(-147.53 -539.83)">
|
|
<path style="stroke:currentColor;stroke-width:2.4501;fill:none" d="m149.38 542.67v39.194h31.354v-39.194z"/>
|
|
<g style="stroke-width:25" transform="matrix(.098003 0 0 .098003 133.69 525.96)">
|
|
<path d="m220 252.36h200" style="stroke:currentColor;stroke-width:25;fill:none"/>
|
|
<path style="stroke:currentColor;stroke-width:25;fill:none" d="m220 409.95h200"/>
|
|
<path d="m220 488.74h200" style="stroke:currentColor;stroke-width:25;fill:none"/>
|
|
<path d="m220 331.15h200" style="stroke:currentColor;stroke-width:25;fill:none"/>
|
|
</g>
|
|
</g>
|
|
</symbol>
|
|
|
|
<symbol id="tick" viewBox="0 0 177.16535 177.16535">
|
|
<g transform="translate(0 -875.2)">
|
|
<rect style="stroke-width:0;fill:currentColor" transform="rotate(30)" height="155" width="40" y="702.99" x="556.82"/>
|
|
<rect style="stroke-width:0;fill:currentColor" transform="rotate(30)" height="40" width="90.404" y="817.99" x="506.42"/>
|
|
</g>
|
|
</symbol>
|
|
</svg>
|
|
|
|
<div class="wrapper print-version">
|
|
<header class="intro-and-nav" role="banner">
|
|
<div>
|
|
<div class="intro">
|
|
<a class="logo" href="https://thepaciellogroup.github.io/cupper/" aria-label="Cupper home page">
|
|
<img src="https://thepaciellogroup.github.io/cupper/images/logo.svg" alt="">
|
|
</a>
|
|
<p class="library-desc">
|
|
Documentation for the <strong>Cupper</strong> documentation builder, built with <strong>Cupper</strong> itself.
|
|
|
|
</a>
|
|
</p>
|
|
|
|
<p class="toc-link">
|
|
<span aria-hidden="true">↓</span>
|
|
<a href="#toc">Table of contents</a>
|
|
<span aria-hidden="true">↓</span>
|
|
</p>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
</header>
|
|
<div class="main-and-footer">
|
|
<div>
|
|
|
|
<main id="main">
|
|
<nav id="toc" class="toc patterns" aria-labelledby="toc-heading">
|
|
<h2 id="toc-heading">Table of contents</h2>
|
|
|
|
|
|
<ul id="patterns-list">
|
|
|
|
<li class="pattern">
|
|
<a href="#installation" >
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
<span class="text">Installation</span>
|
|
</a>
|
|
</li>
|
|
|
|
<li class="pattern">
|
|
<a href="#setup" >
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
<span class="text">Setup</span>
|
|
</a>
|
|
</li>
|
|
|
|
<li class="pattern">
|
|
<a href="#serving" >
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
<span class="text">Serving</span>
|
|
</a>
|
|
</li>
|
|
|
|
<li class="pattern">
|
|
<a href="#printing" >
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
<span class="text">Printing</span>
|
|
</a>
|
|
</li>
|
|
|
|
<li class="pattern">
|
|
<a href="#updating-cupper" >
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
<span class="text">Updating Cupper</span>
|
|
</a>
|
|
</li>
|
|
|
|
|
|
<li>
|
|
<h3>Writing</h3>
|
|
<ul>
|
|
|
|
<li class="pattern">
|
|
<a href="#project-structure" >
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
<span class="text">Project structure</span>
|
|
</a>
|
|
</li>
|
|
|
|
<li class="pattern">
|
|
<a href="#markdown--metadata" >
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
<span class="text">Markdown & metadata</span>
|
|
</a>
|
|
</li>
|
|
|
|
<li class="pattern">
|
|
<a href="#expandable-sections" >
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
<span class="text">Expandable sections</span>
|
|
</a>
|
|
</li>
|
|
|
|
<li class="pattern">
|
|
<a href="#notes--warnings" >
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
<span class="text">Notes & warnings</span>
|
|
</a>
|
|
</li>
|
|
|
|
<li class="pattern">
|
|
<a href="#references" >
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
<span class="text">References</span>
|
|
</a>
|
|
</li>
|
|
|
|
<li class="pattern">
|
|
<a href="#snippets" >
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
<span class="text">Snippets</span>
|
|
</a>
|
|
</li>
|
|
|
|
<li class="pattern">
|
|
<a href="#tables-of-contents" >
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
<span class="text">Tables of contents</span>
|
|
</a>
|
|
</li>
|
|
|
|
</ul>
|
|
</li>
|
|
|
|
<li>
|
|
<h3>Media</h3>
|
|
<ul>
|
|
|
|
<li class="pattern">
|
|
<a href="#including-images" >
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
<span class="text">Including images</span>
|
|
</a>
|
|
</li>
|
|
|
|
<li class="pattern">
|
|
<a href="#including-videos" >
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
<span class="text">Including videos</span>
|
|
</a>
|
|
</li>
|
|
|
|
</ul>
|
|
</li>
|
|
|
|
<li>
|
|
<h3>Coding</h3>
|
|
<ul>
|
|
|
|
<li class="pattern">
|
|
<a href="#code-blocks" >
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
<span class="text">Code blocks</span>
|
|
</a>
|
|
</li>
|
|
|
|
<li class="pattern">
|
|
<a href="#demo-embedding" >
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
<span class="text">Demo embedding</span>
|
|
</a>
|
|
</li>
|
|
|
|
<li class="pattern">
|
|
<a href="#writing-inline-demos" >
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
<span class="text">Writing inline demos</span>
|
|
</a>
|
|
</li>
|
|
|
|
<li class="pattern">
|
|
<a href="#color-palettes" >
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
<span class="text">Color palettes</span>
|
|
</a>
|
|
</li>
|
|
|
|
<li class="pattern">
|
|
<a href="#command-line" >
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
<span class="text">Command line</span>
|
|
</a>
|
|
</li>
|
|
|
|
<li class="pattern">
|
|
<a href="#file-trees" >
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
<span class="text">File trees</span>
|
|
</a>
|
|
</li>
|
|
|
|
<li class="pattern">
|
|
<a href="#tested-using..." >
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
<span class="text">Tested using...</span>
|
|
</a>
|
|
</li>
|
|
|
|
</ul>
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</nav>
|
|
|
|
|
|
|
|
<div class="pattern-section">
|
|
<h1 id="installation" tabindex="-1">
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
Installation
|
|
</h1>
|
|
|
|
|
|
<p><strong>Cupper</strong> is built using the static site engine, <a href="https://gohugo.io/">Hugo</a>, and NPM. The codebase is available to download on Github. Let’s get everything installed step-by-step.</p>
|
|
|
|
<h2 id="install-hugo">Install Hugo</h2>
|
|
|
|
<p>First you need to install Hugo globally.</p>
|
|
|
|
<h3 id="osx-users">OSX users</h3>
|
|
|
|
<p>If you are a Mac user and have <a href="https://brew.sh/">Homebrew</a> on your system, installing Hugo is simple:</p>
|
|
|
|
<pre class="cmd"><code>brew install hugo</code></pre>
|
|
|
|
|
|
<p>Alternatively, you can manually <a href="https://github.com/gohugoio/hugo/releases">install Hugo from a package</a>. You can verify the installation was successful by typing:</p>
|
|
|
|
<pre class="cmd"><code>hugo version</code></pre>
|
|
|
|
|
|
<h3 id="windows-users">Windows users</h3>
|
|
|
|
<p>Installing on Windows is a little more involved than on OSX. The authors of Hugo provide <a href="https://gohugo.io/tutorials/installing-on-windows/">a guide</a> with instructions for technical and less technical users.</p>
|
|
|
|
<p>It’s also best you install a Windows Subsystem for running Linux, and therefore <a href="https://en.wikipedia.org/wiki/Bash_(Unix_shell)">bash</a> (<strong>Cupper</strong> incorporates some bash commands in its scripts). <a href="https://msdn.microsoft.com/en-gb/commandline/wsl/install_guide">Microsoft offer a complete guide</a>.</p>
|
|
|
|
<h2 id="install-node-npm">Install Node & NPM</h2>
|
|
|
|
<p>It is likely you already have Node and NPM installed on your system. If so, you can skip this step. Otherwise, <a href="https://docs.npmjs.com/getting-started/installing-node">refer to NPM’s own guide</a>, which includes a video tutorial.</p>
|
|
|
|
<h2 id="get-the-files">Get the files</h2>
|
|
|
|
<p><strong>Cupper</strong> is hosted on Github. To start using it, you’ll need to get the files from there. If you are comfortable with the command line, just fork the <a href="https://github.com/ThePacielloGroup/cupper">github.com/ThePacielloGroup/cupper</a> repository, then do a <code>git clone</code> to your local system. Replace <code>[your username]</code> in the following:</p>
|
|
|
|
<pre class="cmd"><code>git clone https://github.com/[your username]/cupper.git</code></pre>
|
|
|
|
|
|
<p>If the command line is not your thing, use Github’s web interface to fork <a href="https://github.com/ThePacielloGroup/cupper">github.com/ThePacielloGroup/cupper</a> and choose <strong>Open in Desktop</strong> from <strong>Clone or download</strong> (see figure 1, below).</p>
|
|
|
|
|
|
<figure role="group" aria-describedby="caption-4f6ff97ad7397f1735a833534d0e2e4d">
|
|
<p><img src="https://thepaciellogroup.github.io/cupper/images/open_in_desktop.png" alt="The open in desktop option, revealed when clicking clone or download" /></p>
|
|
|
|
<figcaption id="caption-4f6ff97ad7397f1735a833534d0e2e4d">
|
|
The Github web interface
|
|
</figcaption>
|
|
</figure>
|
|
|
|
|
|
<aside aria-label="note" class="note">
|
|
<div>
|
|
<svg class="sign" aria-hidden="true" viewBox="0 0 41.667306 41.66729" focusable="false">
|
|
<use xlink:href="#info"></use>
|
|
</svg>
|
|
<p>If you do not have a version of the Github desktop client installed, follow the prompts after clicking <strong>Open in Desktop</strong>.</p>
|
|
|
|
</div>
|
|
</aside>
|
|
|
|
|
|
<p>While you’re in the Github interface, you might as well set up the publishing source for the live site. Choose the Master branch/docs option under <strong>Settings → Github Pages → Source</strong>. See <a class="pattern-link" href="https://thepaciellogroup.github.io/cupper/patterns/serving/"><svg class="bookmark" aria-hidden="true" viewBox="0 0 40 50" focusable="false"> <use xlink:href="#bookmark"></use> </svg>Serving</a> for more details.</p>
|
|
|
|
<p>Once you have your local copy of the files, move to the root of that folder and in your terminal run an npm installation:</p>
|
|
|
|
<pre class="cmd"><code>npm install</code></pre>
|
|
|
|
|
|
<p>Now it’s time to consult the <a class="pattern-link" href="https://thepaciellogroup.github.io/cupper/patterns/setup/"><svg class="bookmark" aria-hidden="true" viewBox="0 0 40 50" focusable="false"> <use xlink:href="#bookmark"></use> </svg>Setup</a> pattern.</p>
|
|
|
|
</div>
|
|
|
|
<div class="pattern-section">
|
|
<h1 id="setup" tabindex="-1">
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
Setup
|
|
</h1>
|
|
|
|
|
|
<p>By now, you should have followed the <a class="pattern-link" href="https://thepaciellogroup.github.io/cupper/patterns/installation/"><svg class="bookmark" aria-hidden="true" viewBox="0 0 40 50" focusable="false"> <use xlink:href="#bookmark"></use> </svg>Installation</a> instructions. You should have Hugo and Node installed, and a local copy of a forked version of <strong>Cupper</strong>. You should also have run <code>npm install</code> in the root of that codebase.</p>
|
|
|
|
<h2 id="cleaning-the-content-folder">“Cleaning” the content folder</h2>
|
|
|
|
<p>Before you can start writing documentation, there are a few things still to do in order to get set up. At the moment, your version of <strong>Cupper</strong> is a facsimile of the original, containing all the content you’re reading right now. We want to delete that content and replace it with some starter content. There’s a simple <code>clean</code> command for this.</p>
|
|
|
|
<aside aria-label="warning" class="note warning">
|
|
<div>
|
|
<svg class="sign" aria-hidden="true" viewBox="0 0 48.430474 41.646302" focusable="false">
|
|
<use xlink:href="#warning"></use>
|
|
</svg>
|
|
<p>If you are contributing to an existing <strong>Cupper</strong> library, do not run the following command. It will delete all of the patterns in that library. The <code>clean</code> command is just for libraries that you are starting from scratch.</p>
|
|
|
|
</div>
|
|
</aside>
|
|
|
|
|
|
<pre class="cmd"><code> npm run clean</code></pre>
|
|
|
|
|
|
<p>This will leave your <code>content</code> folder with just an <code>_index.md</code> file and a <code>patterns</code> folder containing a single demonstration pattern file. Individual content pages in <strong>Cupper</strong> are referred to as “patterns” — think pattern libraries). Find out more about these in <a class="pattern-link" href="https://thepaciellogroup.github.io/cupper/patterns/writing/project-structure/"><svg class="bookmark" aria-hidden="true" viewBox="0 0 40 50" focusable="false"> <use xlink:href="#bookmark"></use> </svg>Project structure</a>.</p>
|
|
|
|
<h2 id="the-config-file">The config file</h2>
|
|
|
|
<p>You’ll also want to name your project and configure one or two other things in the <code>config.toml</code> file that’s found at the root of your project. Here’s how that file looks:</p>
|
|
|
|
<pre class="language-html"><code class="language-html" data-codeblock-shortcode>
|
|
languageCode = "en-us"
|
|
title = "Cupper"
|
|
baseURL = "https://thepaciellogroup.github.io/cupper/"
|
|
theme = "cupper"
|
|
|
|
[params]
|
|
description = "Documentation for the **Cupper** documentation builder. This documentation is constructed using the builder itself."
|
|
codePenUser = "Heydon"
|
|
</code></pre>
|
|
|
|
|
|
<ul>
|
|
<li><strong>title</strong> — This is the project’s name, like “Megacorp 5000 Pattern Library” or “Assplosion.js Documentation”. For <strong>Cupper’s</strong> own version of <strong>Cupper</strong>, the <code>title</code> is simply <em>Cupper</em> :-)</li>
|
|
<li><strong>baseURL</strong> — This is the root of the live site. Typically you will publish the site to Github Pages, so this should be the base URL for your Github Pages site.</li>
|
|
<li><strong>theme</strong> — This is the theme the library is using. Don’t change this from “cupper”.</li>
|
|
<li><strong>description</strong> — This is a short description of your documentation project and comes under the logo. You can include markdown syntax here, like <em>**Cupper**</em> in the above example for making the name of the library bold.</li>
|
|
<li><strong>codePenUser</strong> — If you want to embed codePens in your pattern files, you need to supply a codePen username here.</li>
|
|
</ul>
|
|
|
|
<h2 id="the-web-app-manifest">The Web App Manifest</h2>
|
|
|
|
<p><strong>Cupper</strong> projects work as progressive web applications, meaning users can save them to their home screen and read them offline. The web app manifest, found at the root of the <code>static</code> folder, defines names and icons for the app. You’ll probably want to open <code>/static/manifest.json</code> and personalize the <code>name</code> and <code>short_name</code> values.</p>
|
|
|
|
<pre><code>{
|
|
"name": "Cupper Documentation Builder",
|
|
"short_name": "Cupper Docs",
|
|
"icons": [
|
|
{...
|
|
</code></pre>
|
|
|
|
|
|
<figure role="group" aria-describedby="caption-523eedbc53c852c09a6b33234e5e3786">
|
|
<p><img src="https://thepaciellogroup.github.io/cupper/images/samsung_homescreen.png" alt="Teacup Cupper app icon with Cupper Docs written underneath" /></p>
|
|
|
|
<figcaption id="caption-523eedbc53c852c09a6b33234e5e3786">
|
|
Cupper’s Docs, with <code>short_name</code> displayed, available from the homescreen of a Samsung/Android phone.
|
|
</figcaption>
|
|
</figure>
|
|
|
|
|
|
<aside aria-label="note" class="note">
|
|
<div>
|
|
<svg class="sign" aria-hidden="true" viewBox="0 0 41.667306 41.66729" focusable="false">
|
|
<use xlink:href="#info"></use>
|
|
</svg>
|
|
<p>The <code>short_name</code> value refers to the text that appears under the icon on your homescreen. As the name suggests, it should be as short as possible to fit well (12 characters or fewer is ideal).</p>
|
|
|
|
</div>
|
|
</aside>
|
|
|
|
|
|
<h2 id="including-a-logo">Including a logo</h2>
|
|
|
|
<p>In the <code>images/static</code> folder, you’ll find a <code>logo.svg</code> file. Replace this file with your own company or project logo, under the same file name. Currently, only SVG is supported this easily because SVG is the superior format for logos. However, if you must use a different format, you can open up the <code>themes/cupper/layouts/_default/baseof.html</code> file and edit the image reference:</p>
|
|
|
|
<pre><code class="language-html"><a class="logo" href="/" aria-label="{{ .Site.Title }} pattern library home page">
|
|
<img src="{{ "images/logo.svg" | absURL }}" alt="">
|
|
</a>
|
|
</code></pre>
|
|
|
|
<p>Now that your logo is in place, everything should be ready. Where next? You can learn about <a class="pattern-link" href="https://thepaciellogroup.github.io/cupper/patterns/writing/project-structure/"><svg class="bookmark" aria-hidden="true" viewBox="0 0 40 50" focusable="false"> <use xlink:href="#bookmark"></use> </svg>Project structure</a> to help you get writing, or find out how to serve the site locally and on Github Pages in <a class="pattern-link" href="https://thepaciellogroup.github.io/cupper/patterns/serving/"><svg class="bookmark" aria-hidden="true" viewBox="0 0 40 50" focusable="false"> <use xlink:href="#bookmark"></use> </svg>Serving</a>.</p>
|
|
|
|
</div>
|
|
|
|
<div class="pattern-section">
|
|
<h1 id="serving" tabindex="-1">
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
Serving
|
|
</h1>
|
|
|
|
|
|
<h2 id="serving-locally">Serving locally</h2>
|
|
|
|
<p>While you’re creating content for your project, you’ll probably want to see what the finished product looks like. Fortunately, <strong>Cupper</strong> is easy to serve locally using the <code>serve</code> command:</p>
|
|
|
|
<pre class="cmd"><code>npm run serve</code></pre>
|
|
|
|
|
|
<p>This will serve your working project from <code>localhost:1313</code>. Whenever you make changes to your files, the site will automatically rebuild. No need to refresh the web page!</p>
|
|
|
|
<h2 id="publishing-on-github-pages">Publishing on Github Pages</h2>
|
|
|
|
<p><strong>Cupper</strong> creates a <code>/docs</code> folder containing the latest version of your site whenever you do an <code>npm run build</code> or a <code>git commit</code>. So long as you forked the <strong>Cupper</strong> repository when making your own version (see <a class="pattern-link" href="https://thepaciellogroup.github.io/cupper/patterns/setup/"><svg class="bookmark" aria-hidden="true" viewBox="0 0 40 50" focusable="false"> <use xlink:href="#bookmark"></use> </svg>Setup</a>), whenever you push to master, you will also be updating the site found at your Github Pages URL.</p>
|
|
|
|
<p>This URL will be in the following format:</p>
|
|
|
|
<pre><code>[your user name].github.io/[your library repo name]
|
|
</code></pre>
|
|
|
|
<p>You’ll also need to add this value to your <code>config.toml</code> file as the <code>baseURL</code>. For <strong>Cupper</strong>’s own documentation it looks like the following. Just overwrite it.</p>
|
|
|
|
<pre><code>baseURL = "https://thepaciellogroup.github.io/cupper/"
|
|
</code></pre>
|
|
|
|
<h3 id="set-the-publishing-source">Set the publishing source</h3>
|
|
|
|
<p>You will find the <code>docs</code> folder is not automatically setup as the publishing source, even when forking the repo. In which case, you must set it under <strong>Settings → Github Pages → Source</strong> in the web interface.</p>
|
|
|
|
<p><img src="https://thepaciellogroup.github.io/cupper/images/serve_from_docs.png" alt="The publishing source dropdown menu on Github" /></p>
|
|
|
|
</div>
|
|
|
|
<div class="pattern-section">
|
|
<h1 id="printing" tabindex="-1">
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
Printing
|
|
</h1>
|
|
<p><strong>Cupper</strong>’s output site includes a one-page <a class="pattern-link" href="https://thepaciellogroup.github.io/cupper/print-version/"><svg class="bookmark" aria-hidden="true" viewBox="0 0 40 50" focusable="false"> <use xlink:href="#bookmark"></use> </svg>Print version</a> of the generated library, available at <code>/print-version</code>. So, if your library base URL is <code>https://yourName.github.io/your-library</code>, you can print the whole library — to PDF if wanted — from the following address:</p>
|
|
|
|
<pre><code>https://yourName.github.io/your-library/print-version
|
|
</code></pre>
|
|
|
|
<p><aside aria-label="note" class="note">
|
|
<div>
|
|
<svg class="sign" aria-hidden="true" viewBox="0 0 41.667306 41.66729" focusable="false">
|
|
<use xlink:href="#info"></use>
|
|
</svg>
|
|
<p>Print styles are also provided for individual pattern pages so, if you wanted to print off a single pattern document, you can!</p>
|
|
|
|
</div>
|
|
</aside>
|
|
</p>
|
|
|
|
</div>
|
|
|
|
<div class="pattern-section">
|
|
<h1 id="updating-cupper" tabindex="-1">
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
Updating Cupper
|
|
</h1>
|
|
<p>The core of <strong>Cupper’s</strong> functionality is in its Hugo theme, also called <strong>Cupper</strong>. This is found in the theme folder.</p>
|
|
|
|
<div class="file-tree">
|
|
<ul>
|
|
<li>content</li>
|
|
<li>docs</li>
|
|
<li>lib</li>
|
|
<li>snippets</li>
|
|
<li>static</li>
|
|
<li>themes
|
|
|
|
<ul>
|
|
<li>cupper</li>
|
|
</ul></li>
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
|
|
<p>Do not “hack the core”. If you have any issues with <strong>Cupper</strong>, please report them to <a href="https://github.com/ThePacielloGroup/cupper/issues">the <strong>Cupper</strong> Github repository</a> and they will be dealt with ASAP.</p>
|
|
|
|
<p>Cupper is undergoing constant development, so keep an eye out for new releases. To update to a new version of <strong>Cupper</strong>, simply run the <code>update</code> command from inside your local project folder.</p>
|
|
|
|
<pre class="cmd"><code>npm run update</code></pre>
|
|
|
|
|
|
<p>This will save a timestamped backup of the current version, and download the latest version. Your theme folder will now look something like the following.</p>
|
|
|
|
<div class="file-tree">
|
|
<ul>
|
|
<li>themes
|
|
|
|
<ul>
|
|
<li>cupper</li>
|
|
<li>cupper-old-1503389765972</li>
|
|
</ul></li>
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
|
|
<p>If you experience breaking changes and are having trouble fixing them, you can rename the old folder and revert to using it. In the meantime, you can <a href="https://github.com/ThePacielloGroup/cupper/issues">submit an issue</a> with the “help” tag describing your problem.</p>
|
|
|
|
<aside aria-label="warning" class="note warning">
|
|
<div>
|
|
<svg class="sign" aria-hidden="true" viewBox="0 0 48.430474 41.646302" focusable="false">
|
|
<use xlink:href="#warning"></use>
|
|
</svg>
|
|
<p>The described update process relies on SVN because Github does not support downloading individual repository folders. If you have a Mac, SVN should be installed already. If not, or if you are on Windows, you can either install SVN or download the latest <a href="https://github.com/ThePacielloGroup/cupper/tree/master/themes/cupper"><strong>Cupper</strong> theme folder</a> manually, using the Github web interface.</p>
|
|
|
|
</div>
|
|
</aside>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="pattern-section">
|
|
<h1 id="project-structure" tabindex="-1">
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
Project structure
|
|
</h1>
|
|
|
|
|
|
<p>Before you can set about making documentation, you need to know where everything goes. The simplest folder structure looks like this:</p>
|
|
|
|
<div class="file-tree">
|
|
<ul>
|
|
<li>content
|
|
|
|
<ul>
|
|
<li>_index.md</li>
|
|
<li>print-version.md</li>
|
|
<li>patterns
|
|
|
|
<ul>
|
|
<li>name-of-my-pattern.md</li>
|
|
<li>name-of-my-other-pattern.md</li>
|
|
</ul></li>
|
|
</ul></li>
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
|
|
<ul>
|
|
<li><strong>/content</strong> - This is where all of your content lives. You won’t need to visit any other folders very frequently.</li>
|
|
<li><strong>_index.md</strong> — This is the content file for your home page.</li>
|
|
<li><strong>print-version.md</strong> — This is a placeholder for the single-page / print-friendly version of you library. Leave this file as it is.</li>
|
|
<li><strong>/patterns</strong> — This is the folder where individual content files are kept. <strong>Cupper</strong> refers to each individual documentation file/page as a “pattern”.</li>
|
|
</ul>
|
|
|
|
<h2 id="subsections">Subsections</h2>
|
|
|
|
<p>You may have noticed that this site’s navigation is divided partly into subsections, with labels like “Writing”. <strong>Cupper</strong> (or, rather, Hugo) allows you to create such subsections by simply nesting folders under the <code>/patterns</code> folder. In the following example, I have a subsection about different types of “popup” pattern.</p>
|
|
|
|
<div class="file-tree">
|
|
<ul>
|
|
<li>content
|
|
|
|
<ul>
|
|
<li>_index.md</li>
|
|
<li>patterns
|
|
|
|
<ul>
|
|
<li>name-of-my-pattern.md</li>
|
|
<li>name-of-my-other-pattern.md</li>
|
|
<li>popups
|
|
|
|
<ul>
|
|
<li>_index.md</li>
|
|
<li>popup-menu.md</li>
|
|
<li>tooltips.md</li>
|
|
</ul></li>
|
|
</ul></li>
|
|
</ul></li>
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
|
|
<p>Subfolders like <code>/popups</code> must each have an <code>_index.md</code> file. This file doesn’t need any content except the TOML metadata defining the title (name) of that subsection:</p>
|
|
|
|
<pre><code>+++
|
|
title = "Popup windows"
|
|
+++
|
|
</code></pre>
|
|
|
|
<p>This title is what labels the subsection in the navigation, <em>not</em> the folder name (<code>/popups</code>, in this case). For each subfolder you create, you must also create one of these <code>_index.md</code> files. The <code>/patterns</code> folder itself does not need one, however.</p>
|
|
|
|
<aside aria-label="note" class="note">
|
|
<div>
|
|
<svg class="sign" aria-hidden="true" viewBox="0 0 41.667306 41.66729" focusable="false">
|
|
<use xlink:href="#info"></use>
|
|
</svg>
|
|
<p><strong>Cupper</strong> does not currently support <em>sub</em>-subsections. You can only create child folders under <code>/patterns</code>.</p>
|
|
|
|
</div>
|
|
</aside>
|
|
|
|
|
|
<p>Now that you know where to put everything, it’s time to talk about how to actually write individual patterns. Don’t worry, it’s pretty straightforward. Turn to <a class="pattern-link" href="https://thepaciellogroup.github.io/cupper/patterns/writing/markdown-and-metadata/"><svg class="bookmark" aria-hidden="true" viewBox="0 0 40 50" focusable="false"> <use xlink:href="#bookmark"></use> </svg>Markdown & metadata</a>.</p>
|
|
|
|
</div>
|
|
|
|
<div class="pattern-section">
|
|
<h1 id="markdown--metadata" tabindex="-1">
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
Markdown & metadata
|
|
</h1>
|
|
|
|
|
|
<p>In <strong>Cupper</strong> everything is documented using markdown, as a “pattern”. To create a new pattern file, just add a file with the <code>.md</code> extension to the <code>content/patterns</code> folder. It’s recommended you use “kebab case” to name the file (words separated by hyphens). For example, a pattern with the title “Menu button” should probably have the filename <code>menu-button</code>. Then you get a nice clean URL: <code>username.github.io/your-library/patterns/menu-button</code>.</p>
|
|
|
|
<p>If you’re not familiar with writing markdown, there are a number of tutorials available. One of the best is <a href="https://guides.github.com/features/mastering-markdown/">Mastering Markdown</a> offered by Github. There’s also a <a href="https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet">nice cheatsheet here</a>.</p>
|
|
|
|
<h2 id="the-metadata">The metadata</h2>
|
|
|
|
<p>Like many static site generators, Hugo lets you add metadata to its markdown files. Hugo’s brand of metadata is called TOML (although YAML is also accepted). The only thing you <em>have</em> to put in the TOML is a <code>title</code> — like this:</p>
|
|
|
|
<pre><code>+++
|
|
title = "Menu button"
|
|
+++
|
|
</code></pre>
|
|
|
|
<aside aria-label="note" class="note">
|
|
<div>
|
|
<svg class="sign" aria-hidden="true" viewBox="0 0 41.667306 41.66729" focusable="false">
|
|
<use xlink:href="#info"></use>
|
|
</svg>
|
|
<p>The title automatically becomes the page’s main <code><h1></code> heading. The highest heading level you should use in the body of your markdown file is therefore <code><h2></code>.</p>
|
|
|
|
</div>
|
|
</aside>
|
|
|
|
|
|
<h3 id="tags">Tags</h3>
|
|
|
|
<p>If you like, you can also tag the pattern so that it turns up in lists of similar content. You add tags in an array format. Note that all the TOML data is found at the top of the markdown file, between the <code>+++</code> lines.</p>
|
|
|
|
<pre><code>+++
|
|
title = "Menu button"
|
|
tags = ["interactive", "popup", "javascript"]
|
|
+++
|
|
</code></pre>
|
|
|
|
<p>This will create links to pages listing content tagged with the same terms using the URL schema <code>/tag/[tag name]</code>. Some example tags links are provided for this page, which you can see listed under the main heading.</p>
|
|
|
|
<h3 id="weight">Weight</h3>
|
|
|
|
<p>By default, patterns are listed alphabetically in the navigation. However, sometimes you might like to change the order around. This is possible by adding a <code>weight</code> parameter. To make my menu button pattern appear at the top of its subsection, I would give it a <code>weight</code> of <code>1</code>:</p>
|
|
|
|
<pre><code>+++
|
|
title = "Menu button"
|
|
tags = ["interactive", "popup", "javascript"]
|
|
weight = 1
|
|
+++
|
|
</code></pre>
|
|
|
|
<aside aria-label="warning" class="note warning">
|
|
<div>
|
|
<svg class="sign" aria-hidden="true" viewBox="0 0 48.430474 41.646302" focusable="false">
|
|
<use xlink:href="#warning"></use>
|
|
</svg>
|
|
<p>The <code>weight</code> parameter should be an integer, not a string, so don’t use scare quotes around the value!</p>
|
|
|
|
</div>
|
|
</aside>
|
|
|
|
|
|
</div>
|
|
|
|
<div class="pattern-section">
|
|
<h1 id="expandable-sections" tabindex="-1">
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
Expandable sections
|
|
</h1>
|
|
<p>In some cases, where there is a lot of content, it’s helpful to collapse certain sections. That way, readers get an overview of what’s in the content and can choose where to focus in. <strong>Cupper</strong> provides a shortcode method for creating expandable sections which generates accessible markup using <code>aria-expanded</code>.</p>
|
|
|
|
<p>The <code>expandable</code> shortcode takes three parameters:</p>
|
|
|
|
<ul>
|
|
<li><strong>label</strong> — This is the label for the the section heading.</li>
|
|
<li><strong>level</strong> — This is the heading level (e.g. <code>level="2"</code> for an <code><h2></code>) that will contain the label. If you omit a level parameter, no heading is used; it’s just a button.</li>
|
|
<li><strong>open</strong> — Include this and give it a value of “true” or “yes” to make the section expanded on page load.</li>
|
|
</ul>
|
|
|
|
<p>Here’s what the code might look like for a simple expandable section containing markdown:</p>
|
|
|
|
<pre class=""><code data-codeblock-shortcode>
|
|
{{% expandable label="A section of dummy text" level="2" %}}
|
|
Here is some markdown including [a link](https://twitter.com/heydonworks). Donec erat est, feugiat a est sed, aliquet pharetra ipsum. Vivamus in arcu leo. Praesent feugiat, purus a molestie ultrices, libero massa iaculis ante, sit amet accumsan leo eros vel ligula.
|
|
{{% /expandable %}}
|
|
</code></pre>
|
|
|
|
|
|
<p>Let’s look at what that outputs:</p>
|
|
|
|
<div class="expandable-section">
|
|
|
|
<h2>
|
|
|
|
<button aria-expanded="false" data-expands="js-expandable-4ab31bdd2c2d9d4cac64804c775e2683">
|
|
<span class="expandable-label">A section of dummy text</span>
|
|
<svg aria-hidden="true" focusable="false" viewBox="0 0 70.866142 70.866141">
|
|
<g transform="translate(0 -981.5)">
|
|
<rect style="stroke-width:0;fill:currentColor" ry="5" height="60" width="9.8985" y="987.36" x="30.051" class="up-strut" />
|
|
<rect style="stroke-width:0;fill:currentColor" ry="5" height="10" width="60" y="1012.4" x="5"/>
|
|
</g>
|
|
</svg>
|
|
</button>
|
|
|
|
</h2>
|
|
|
|
<div id="js-expandable-4ab31bdd2c2d9d4cac64804c775e2683" hidden>
|
|
<p>Here is some markdown including <a href="https://twitter.com/heydonworks">a link</a>. Donec erat est, feugiat a est sed, aliquet pharetra ipsum. Vivamus in arcu leo. Praesent feugiat, purus a molestie ultrices, libero massa iaculis ante, sit amet accumsan leo eros vel ligula.</p>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<p>Successive collapsible sections fit snugly together. The second of the following two has <code>open="true"</code>.</p>
|
|
|
|
<div class="expandable-section">
|
|
|
|
<h2>
|
|
|
|
<button aria-expanded="false" data-expands="js-expandable-ade9cd5456422b2a456101177ddc6f3f">
|
|
<span class="expandable-label">A section of dummy text</span>
|
|
<svg aria-hidden="true" focusable="false" viewBox="0 0 70.866142 70.866141">
|
|
<g transform="translate(0 -981.5)">
|
|
<rect style="stroke-width:0;fill:currentColor" ry="5" height="60" width="9.8985" y="987.36" x="30.051" class="up-strut" />
|
|
<rect style="stroke-width:0;fill:currentColor" ry="5" height="10" width="60" y="1012.4" x="5"/>
|
|
</g>
|
|
</svg>
|
|
</button>
|
|
|
|
</h2>
|
|
|
|
<div id="js-expandable-ade9cd5456422b2a456101177ddc6f3f" hidden>
|
|
<p>Mauris eget elit ut neque venenatis placerat id nec libero. Nunc accumsan cursus elit nec iaculis. Proin id rutrum magna, a aliquet sem. Sed et tortor id sem eleifend porta vitae eget elit. Cras sodales porta malesuada. Suspendisse at odio ac tortor.</p>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="expandable-section">
|
|
|
|
<h2>
|
|
|
|
<button aria-expanded="true" data-expands="js-expandable-4d6feae4dfbb8614dd5fa6730b3dfa5e">
|
|
<span class="expandable-label">Another dummy section</span>
|
|
<svg aria-hidden="true" focusable="false" viewBox="0 0 70.866142 70.866141">
|
|
<g transform="translate(0 -981.5)">
|
|
<rect style="stroke-width:0;fill:currentColor" ry="5" height="60" width="9.8985" y="987.36" x="30.051" class="up-strut" />
|
|
<rect style="stroke-width:0;fill:currentColor" ry="5" height="10" width="60" y="1012.4" x="5"/>
|
|
</g>
|
|
</svg>
|
|
</button>
|
|
|
|
</h2>
|
|
|
|
<div id="js-expandable-4d6feae4dfbb8614dd5fa6730b3dfa5e" >
|
|
<p>Ut vulputate enim ut lorem iaculis, vel faucibus metus iaculis. Aliquam erat volutpat. Aliquam luctus orci vel consectetur dignissim. Nullam et efficitur lorem, et ornare est. Sed tristique porttitor justo, quis malesuada velit. Nullam et elit finibus, sollicitudin velit placerat, ultricies dui.</p>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<p>Unfortunately, it is not currently possible to include shortcodes inside other shortcodes, using the “<code>%</code>” notation (which is designated for markdown content). If you use the angle brackets notation (illustrated below) it is possible, but markdown will no longer be permitted. You will have to code HTML inside such a section manually.</p>
|
|
|
|
<pre class=""><code data-codeblock-shortcode>
|
|
{{<expandable label="A section of dummy text" level="2">}}
|
|
<p>Here is a pattern reference shortcode: {{% pattern "Writing inline demos" %}}.</p>
|
|
{{</expandable>}}
|
|
</code></pre>
|
|
|
|
|
|
<aside aria-label="note" class="note">
|
|
<div>
|
|
<svg class="sign" aria-hidden="true" viewBox="0 0 41.667306 41.66729" focusable="false">
|
|
<use xlink:href="#info"></use>
|
|
</svg>
|
|
<p>When you go to print a pattern from your library, some print styles take care of collapsible sections, making them appear expanded and like any other section.</p>
|
|
|
|
</div>
|
|
</aside>
|
|
|
|
|
|
</div>
|
|
|
|
<div class="pattern-section">
|
|
<h1 id="notes--warnings" tabindex="-1">
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
Notes & warnings
|
|
</h1>
|
|
|
|
|
|
<p><strong>Cupper</strong> acknowledges that simple markdown is limiting when it comes to writing compelling documentation, so it provides a number of “shortcodes”. Shortcodes offer a simple syntax for including rich content. For example, <strong>Cupper</strong> provides shortcodes for including notes and warnings.</p>
|
|
|
|
<h2 id="notes">Notes</h2>
|
|
|
|
<p>You may wish to pick out some content in your pattern’s documentation as a note — an aside to the main thrust of the pattern’s description. This is possible using the following syntax:</p>
|
|
|
|
<pre class=""><code data-codeblock-shortcode>
|
|
{{% note %}}
|
|
This is a note! It's something the reader may like to know about but is supplementary to the main content. Use notes when something may be interesting but not critical.
|
|
{{% /note %}}
|
|
</code></pre>
|
|
|
|
|
|
<p>Notes render like this:</p>
|
|
|
|
<aside aria-label="note" class="note">
|
|
<div>
|
|
<svg class="sign" aria-hidden="true" viewBox="0 0 41.667306 41.66729" focusable="false">
|
|
<use xlink:href="#info"></use>
|
|
</svg>
|
|
<p>This is a note! It’s something the reader may like to know about but is supplementary to the main content. Use notes when something may be interesting but not critical.</p>
|
|
|
|
</div>
|
|
</aside>
|
|
|
|
|
|
<h2 id="warnings">Warnings</h2>
|
|
|
|
<p>Warnings are like notes, but with more urgency.</p>
|
|
|
|
<pre class=""><code data-codeblock-shortcode>
|
|
{{% warning %}}
|
|
This is a warning! It's about something the reader should be careful to do or to avoid doing. Use warnings when something could go wrong.
|
|
{{% /warning %}}
|
|
</code></pre>
|
|
|
|
|
|
<p>Warnings render like this:</p>
|
|
|
|
<aside aria-label="warning" class="note warning">
|
|
<div>
|
|
<svg class="sign" aria-hidden="true" viewBox="0 0 48.430474 41.646302" focusable="false">
|
|
<use xlink:href="#warning"></use>
|
|
</svg>
|
|
<p>This is a warning! It’s about something the reader should be careful to do or to avoid doing. Use warnings when something could go wrong.</p>
|
|
|
|
</div>
|
|
</aside>
|
|
|
|
|
|
</div>
|
|
|
|
<div class="pattern-section">
|
|
<h1 id="references" tabindex="-1">
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
References
|
|
</h1>
|
|
|
|
|
|
<h2 id="cross-references">Cross-references</h2>
|
|
|
|
<p><strong>Cupper</strong> identifies the main content files in your documentation as <em>patterns</em>, and they’re kept in the <strong>content/ patterns</strong> folder. It’s easy to cross-reference patterns using the <code>pattern</code> shortcode. For example, I can reference the <a class="pattern-link" href="https://thepaciellogroup.github.io/cupper/patterns/writing/notes-and-warnings/"><svg class="bookmark" aria-hidden="true" viewBox="0 0 40 50" focusable="false"> <use xlink:href="#bookmark"></use> </svg>Notes & warnings</a> pattern. Here’s what the markdown looks like, including the shortcode:</p>
|
|
|
|
<pre class=""><code data-codeblock-shortcode>
|
|
I can reference the {{% pattern "Notes & warnings" %}} pattern here.
|
|
</code></pre>
|
|
|
|
|
|
<p>This saves you having to worry about pathing and decorates the generated link with a bookmark icon, identifying the link as a pattern reference visually.</p>
|
|
|
|
<aside aria-label="note" class="note">
|
|
<div>
|
|
<svg class="sign" aria-hidden="true" viewBox="0 0 41.667306 41.66729" focusable="false">
|
|
<use xlink:href="#info"></use>
|
|
</svg>
|
|
<p>The title argument you supply to the shortcode must be exactly the same as the referenced pattern’s <code>title</code> metadata value and is case sensitive.</p>
|
|
|
|
</div>
|
|
</aside>
|
|
|
|
|
|
<h2 id="wcag-references">WCAG References</h2>
|
|
|
|
<p><a href="https://www.w3.org/TR/WCAG/">WCAG 2.0</a> is the <em>de facto</em> standard for accessible interfaces. When writing about inclusive interfaces, sometimes you’ll want to refer to WCAG to highlight which success criteria the pattern meets.</p>
|
|
|
|
<p>Instead of having to copy and paste content and links to WCAG, <strong>Cupper</strong> provides a shortcode mechanism that lets you simply list the success criteria by number:</p>
|
|
|
|
<pre class=""><code data-codeblock-shortcode>
|
|
{{% wcag include="1.2.1, 1.3.1, 4.1.2" %}}
|
|
</code></pre>
|
|
|
|
|
|
<p>This generates a list of references that includes the names of each criterion and links to them directly. Like this:</p>
|
|
|
|
|
|
|
|
|
|
|
|
<ul class="wcag ">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li>
|
|
<strong><a href="https://www.w3.org/TR/WCAG20/#keyboard-operation-keyboard-operable">
|
|
<svg class="wcag-icon" viewBox="0 0 127.09899 67.763" aria-hidden="true" focusable="false">
|
|
<use xlink:href="#w3c"></use>
|
|
</svg>
|
|
2.1.1 Keyboard</a> (level A)
|
|
</strong>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li>
|
|
<strong><a href="https://www.w3.org/TR/WCAG20/#ensure-compat-rsv">
|
|
<svg class="wcag-icon" viewBox="0 0 127.09899 67.763" aria-hidden="true" focusable="false">
|
|
<use xlink:href="#w3c"></use>
|
|
</svg>
|
|
4.1.2 Name, Role, Value</a> (level A)
|
|
</strong>
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
<aside aria-label="note" class="note">
|
|
<div>
|
|
<svg class="sign" aria-hidden="true" viewBox="0 0 41.667306 41.66729" focusable="false">
|
|
<use xlink:href="#info"></use>
|
|
</svg>
|
|
<p>You don’t have to leave spaces after the comma separators. They are optional.</p>
|
|
|
|
</div>
|
|
</aside>
|
|
|
|
|
|
<h3 id="full-descriptions">Full descriptions</h3>
|
|
|
|
<p>Sometimes, you’ll want to include the full descriptions of the success criteria inline. This is possible by setting <code>descriptions</code> to <code>true</code>:</p>
|
|
|
|
<pre class=""><code data-codeblock-shortcode>
|
|
{{% wcag include="1.3.1, 4.1.2" descriptions="true" %}}
|
|
</code></pre>
|
|
|
|
|
|
<p>Here’s the more verbose output:</p>
|
|
|
|
|
|
|
|
|
|
|
|
<ul class="wcag with-desc">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li>
|
|
<strong><a href="https://www.w3.org/TR/WCAG20/#keyboard-operation-keyboard-operable">
|
|
<svg class="wcag-icon" viewBox="0 0 127.09899 67.763" aria-hidden="true" focusable="false">
|
|
<use xlink:href="#w3c"></use>
|
|
</svg>
|
|
2.1.1 Keyboard</a> (level A):
|
|
</strong>
|
|
|
|
All functionality of the content is operable through a keyboard interface without requiring specific timings for individual keystrokes, except where the underlying function requires input that depends on the path of the user's movement and not just the endpoints
|
|
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li>
|
|
<strong><a href="https://www.w3.org/TR/WCAG20/#ensure-compat-rsv">
|
|
<svg class="wcag-icon" viewBox="0 0 127.09899 67.763" aria-hidden="true" focusable="false">
|
|
<use xlink:href="#w3c"></use>
|
|
</svg>
|
|
4.1.2 Name, Role, Value</a> (level A):
|
|
</strong>
|
|
|
|
For all user interface components (including but not limited to: form elements, links and components generated by scripts), the name and role can be programmatically determined; states, properties, and values that can be set by the user can be programmatically set; and notification of changes to these items is available to user agents, including assistive technologies.
|
|
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
<aside aria-label="note" class="note">
|
|
<div>
|
|
<svg class="sign" aria-hidden="true" viewBox="0 0 41.667306 41.66729" focusable="false">
|
|
<use xlink:href="#info"></use>
|
|
</svg>
|
|
<p>Both omitting the <code>descriptions</code> attribute and including it with a “false” value will omit descriptions. If it is included it <em>must</em> have a value. A boolean attribute will break the output.</p>
|
|
|
|
</div>
|
|
</aside>
|
|
|
|
|
|
<h2 id="inclusive-design-principle-references">Inclusive Design Principle references</h2>
|
|
|
|
<p>Some inclusive design concepts are not reducible to success or fail criteria. This is why The Paciello Group wrote the <a href="http://inclusivedesignprinciples.org/">Inclusive Design Principles</a>. These can be listed by name.</p>
|
|
|
|
<pre class=""><code data-codeblock-shortcode>
|
|
{{% principles include="Add value, Be consistent" descriptions="true" %}}
|
|
</code></pre>
|
|
|
|
|
|
<p>Here’s the output with <code>descriptions="true"</code>:</p>
|
|
|
|
|
|
|
|
|
|
|
|
<ul class="principles with-desc">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li>
|
|
<strong>
|
|
<a href="https://inclusivedesignprinciples.org#be-consistent">
|
|
<svg class="balloon-icon" viewBox="0 0 141.73228 177.16535" aria-hidden="true" focusable="false">
|
|
<use xlink:href="#balloon"></use>
|
|
</svg>
|
|
Be consistent
|
|
</a>:
|
|
</strong>
|
|
<em>Use familiar conventions and apply them consistently.</em>
|
|
|
|
<p>Familiar interfaces borrow from well-established patterns. These should be used consistently within the interface to reinforce their meaning and purpose. This should be applied to functionality, behavior, editorial, and presentation. You should say the same things in the same way and users should be able to do the same things in the same way.</p>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li>
|
|
<strong>
|
|
<a href="https://inclusivedesignprinciples.org#add-value">
|
|
<svg class="balloon-icon" viewBox="0 0 141.73228 177.16535" aria-hidden="true" focusable="false">
|
|
<use xlink:href="#balloon"></use>
|
|
</svg>
|
|
Add value
|
|
</a>:
|
|
</strong>
|
|
<em>Consider the value of features and how they improve the experience for different users.</em>
|
|
|
|
<p>Features should add value to the user experience by providing efficient and diverse ways to find and interact with content. Consider device features such as voice, geolocation, camera and vibration API's, and how integration with connected devices or a second screen could provide choice.</p>
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
</div>
|
|
|
|
<div class="pattern-section">
|
|
<h1 id="snippets" tabindex="-1">
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
Snippets
|
|
</h1>
|
|
|
|
|
|
<p>A lot of the time, your larger documentation patterns will share some common techniques and utilities. For this reason, <strong>Cupper</strong> lets you save snippets of markdown in a <strong>snippets</strong> folder, alongside the main content folder.</p>
|
|
|
|
<p>The example <code>visually-hidden.md</code> snippet describes the CSS needed to create content that is visually hidden but still available to screen readers. Since this is a technique/utility you are likely to use often, it’s nice to be able to just drop a snippet into your markdown content. The <code>snippet</code> shortcode lets you do exactly that:</p>
|
|
|
|
<pre class=""><code data-codeblock-shortcode>
|
|
{{% snippet file="visually-hidden.md" %}}
|
|
</code></pre>
|
|
|
|
|
|
<aside aria-label="note" class="note">
|
|
<div>
|
|
<svg class="sign" aria-hidden="true" viewBox="0 0 41.667306 41.66729" focusable="false">
|
|
<use xlink:href="#info"></use>
|
|
</svg>
|
|
<p>To make your snippets truly reusable, try to write them in such a way that they make sense independent of surrounding text, a little bit like this note does.</p>
|
|
|
|
</div>
|
|
</aside>
|
|
|
|
|
|
<h2 id="visually-hidden-snippet">Visually hidden snippet</h2>
|
|
|
|
|
|
|
|
|
|
<!-- snippet -->
|
|
|
|
<p>The <code>visually-hidden</code> utility class uses a set of special properties to hide content visually without making it unavailable to screen readers and other non-visual user agents. The class is defined like this:</p>
|
|
|
|
<pre><code class="language-CSS">.visually-hidden {
|
|
position: absolute !important;
|
|
clip: rect(1px, 1px, 1px, 1px) !important;
|
|
padding:0 !important;
|
|
border:0 !important;
|
|
height: 1px !important;
|
|
width: 1px !important;
|
|
overflow: hidden !important;
|
|
}
|
|
</code></pre>
|
|
|
|
<p>Use it sparingly since, in most cases, what is identified non-visually should also be presented visually. Bear in mind that not all screen reader users are blind users.
|
|
|
|
|
|
</div>
|
|
|
|
<div class="pattern-section">
|
|
<h1 id="tables-of-contents" tabindex="-1">
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
Tables of contents
|
|
</h1>
|
|
<p>Pattern pages in <strong>Cupper</strong> that have two or more subheadings (<code><h2></code>s) automatically get a <strong>table of contents</strong>: a list of links to the main subsections for the page. This feature is made accessible as a navigation region with the “Table of contents” label and uses an ordered list. The table of contents markup for the <a class="pattern-link" href="https://thepaciellogroup.github.io/cupper/patterns/setup/"><svg class="bookmark" aria-hidden="true" viewBox="0 0 40 50" focusable="false"> <use xlink:href="#bookmark"></use> </svg>Setup</a> page looks something like this:</p>
|
|
|
|
<pre><code class="language-html"><nav class="toc" aria-labelledby="toc-heading">
|
|
<h2 id="toc-heading">Table of contents</h2>
|
|
<ol>
|
|
<li>
|
|
<a href="#cleaning-the-content-folder">“Cleaning” the content folder</a>
|
|
</li>
|
|
<li>
|
|
<a href="#the-setup-command">The setup command</a>
|
|
</li>
|
|
<li>
|
|
<a href="#the-config-file">The config file</a>
|
|
</li>
|
|
<li>
|
|
<a href="#including-a-logo">Including a logo</a>
|
|
</li>
|
|
</ol>
|
|
</nav>
|
|
</code></pre>
|
|
|
|
<p>Tables of content are a neat way to break down the content of the page and give users a navigable overview. However, they may not be to your taste. Never fear, you can turn tables of content off by adding <code>toc = false</code> to the TOML metadata for your pattern:</p>
|
|
|
|
<pre><code>+++
|
|
title = "My page with a few headings"
|
|
toc = false
|
|
+++
|
|
</code></pre>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="pattern-section">
|
|
<h1 id="including-images" tabindex="-1">
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
Including images
|
|
</h1>
|
|
|
|
|
|
<p>From time to time, you’ll be wanting to include images illustrating the documented pattern in hand. Images live in the static folder, which is a sibling of the <code>/content</code> folder you’ll be mostly working in.</p>
|
|
|
|
<div class="file-tree">
|
|
<ul>
|
|
<li>content</li>
|
|
<li>static
|
|
|
|
<ul>
|
|
<li>images
|
|
|
|
<ul>
|
|
<li>logo.png</li>
|
|
<li>menu-button.gif</li>
|
|
</ul></li>
|
|
</ul></li>
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
|
|
<aside aria-label="note" class="note">
|
|
<div>
|
|
<svg class="sign" aria-hidden="true" viewBox="0 0 41.667306 41.66729" focusable="false">
|
|
<use xlink:href="#info"></use>
|
|
</svg>
|
|
<p>When you first make a copy of <strong>Cupper</strong>, <strong>Cupper’s</strong> own logo will be included. You should replace this with your own company or project logo.</p>
|
|
|
|
</div>
|
|
</aside>
|
|
|
|
|
|
<p>The path to the <code>/images</code> folder should begin with a forward slash, so include that when referencing images in your markdown.</p>
|
|
|
|
<pre><code>![Global Megacorp Ltd](/images/logo.png)
|
|
</code></pre>
|
|
|
|
<h2 id="figures">Figures</h2>
|
|
|
|
<p>Sometimes you will want to include a caption with your illustration. This is what the <code><figure></code> and <code><figcaption></code> elements are for. However, <strong>Cupper</strong> doesn’t ask you to code all that manually. A special shortcode is provided, which takes a <code>caption</code> parameter. Note that the image markdown is provided between the opening and closing shortcode tags, and that you can use markdown syntax in the <code>caption</code> value.</p>
|
|
|
|
<pre class=""><code data-codeblock-shortcode>
|
|
{{% figure caption="A design system that uses a bad code example as a **single source of truth** only serves to proliferate bad code." %}}
|
|
![Diagram of a design pattern represented by a turd emoji begetting three bad implementations](/images/bad_design_system.png)
|
|
{{% /figure %}}
|
|
</code></pre>
|
|
|
|
|
|
<p>This will output the following. Note the automatically incremented <strong>Figure</strong> number.</p>
|
|
|
|
|
|
<figure role="group" aria-describedby="caption-e259e3056337abf60723ee4eb78ed9b6">
|
|
<p><img src="https://thepaciellogroup.github.io/cupper/images/bad_design_system.png" alt="Diagram of a design pattern represented by a turd emoji begetting three bad implementations" /></p>
|
|
|
|
<figcaption id="caption-e259e3056337abf60723ee4eb78ed9b6">
|
|
A design system that uses a bad code example as a <strong>single source of truth</strong> only serves to proliferate bad code.
|
|
</figcaption>
|
|
</figure>
|
|
|
|
|
|
<p>The generated markup includes special provisions for assistive technology support:</p>
|
|
|
|
<pre><code class="language-html"><figure role="group" aria-describedby="caption-5fbafefe946c724e7a5d3d2d447a8684">
|
|
<p><img src="http://localhost:1313/images/bad_design_system.png" alt="Diagram of a design pattern represented by a turd emoji begetting three bad implementations"></p>
|
|
<figcaption id="caption-5fbafefe946c724e7a5d3d2d447a8684">
|
|
A design system that uses a bad code example as a <strong>single source of truth</strong> only serves to proliferate bad code.
|
|
</figcaption>
|
|
</figure>
|
|
</code></pre>
|
|
|
|
</div>
|
|
|
|
<div class="pattern-section">
|
|
<h1 id="including-videos" tabindex="-1">
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
Including videos
|
|
</h1>
|
|
<p><strong>Cupper</strong> has a lot of its own shortcodes, but you can still use Hugo’s <a href="https://gohugo.io/extras/shortcodes#built-in-shortcodes">built in shortcodes</a>. These include a simple shortcode for including YouTube videos in your content. The shortcode takes just one parameter — the video’s <code>id</code>.</p>
|
|
|
|
<pre class=""><code data-codeblock-shortcode>
|
|
{{<youtube w7Ft2ymGmfc>}}
|
|
</code></pre>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="pattern-section">
|
|
<h1 id="code-blocks" tabindex="-1">
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
Code blocks
|
|
</h1>
|
|
|
|
|
|
<p>Markdown already supports code samples both inline (using single backticks like `some code here`) and in blocks. <strong>Cupper</strong> will syntax highlight HTML, CSS, and JavaScript if you provide the correct language in the formulation of the block.</p>
|
|
|
|
<p>So, this…</p>
|
|
|
|
<pre class=""><code data-codeblock-shortcode>
|
|
```html
|
|
<button aria-pressed="false">toggle me</button>
|
|
```
|
|
</code></pre>
|
|
|
|
|
|
<p>… will result in this:</p>
|
|
|
|
<pre><code class="language-html"><button aria-pressed="false">toggle me</button>
|
|
</code></pre>
|
|
|
|
<p>Note that the syntax highlighting uses a greyscale theme. <strong>Cupper</strong> is careful not to use color as part of its own design, because these colors may clash with those of the design being illustrated and discussed.</p>
|
|
|
|
<aside aria-label="note" class="note">
|
|
<div>
|
|
<svg class="sign" aria-hidden="true" viewBox="0 0 41.667306 41.66729" focusable="false">
|
|
<use xlink:href="#info"></use>
|
|
</svg>
|
|
<p>To preserve the wrapping inside code blocks, horizontal scrolling is implemented. To make sure scrolling is keyboard accessible, code blocks are focusable. An <code>aria-label</code> is provided to identify the code block to screen reader users.</p>
|
|
|
|
</div>
|
|
</aside>
|
|
|
|
|
|
<h2 id="annotated-code">Annotated code</h2>
|
|
|
|
<p><strong>Cupper</strong> offers the ability to highlight and annotate specific parts of your code examples using the <code>code</code> shortcode. Take an accessible dialog. You may wish to point out key attributes that make that dialog support assistive technologies:</p>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="code-annotated "><code>
|
|
<div <span class='highlight'>role="dialog"</span> <span class='highlight'>aria-labelledby="dialog-heading"</span>>
|
|
<button <span class='highlight'>aria-label="close"</span>>x</button>
|
|
<h2 <span class='highlight'>id="dialog-heading"</span>>Confirmation</h2>
|
|
<p>Press <strong>Okay</strong> to confirm or <strong>Cancel</strong></p>
|
|
<button>Okay</button>
|
|
<button>Cancel</button>
|
|
</div>
|
|
</code></div>
|
|
|
|
|
|
<p>You mark out the highlighted areas using triple square brackets like so:</p>
|
|
|
|
<pre class=""><code data-codeblock-shortcode>
|
|
{{<code>}}
|
|
<div [[[role="dialog"]]] [[[aria-labelledby="dialog-heading"]]]>
|
|
<button [[[aria-label="close"]]]>x</button>
|
|
<h2 [[[id="dialog-heading"]]]>Confirmation</h2>
|
|
<p>Press <strong>Okay</strong> to confirm or <strong>Cancel</strong></p>
|
|
<button>Okay</button>
|
|
<button>Cancel</button>
|
|
</div>
|
|
{{</code>}}
|
|
</code></pre>
|
|
|
|
|
|
<p>Better still, if you include <code>numbered="true"</code>, each highlight is enumerated so you can reference it directly in the ensuing text. If you follow the shortcode directly with an ordered list, the styles match:</p>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="code-annotated numbered"><code>
|
|
<div <span class='highlight'>role="dialog"</span> <span class='highlight'>aria-labelledby="dialog-heading"</span>>
|
|
<button <span class='highlight'>aria-label="close"</span>>x</button>
|
|
<h2 <span class='highlight'>id="dialog-heading"</span>>Confirmation</h2>
|
|
<p>Press <strong>Okay</strong> to confirm or <strong>Cancel</strong></p>
|
|
<button>Okay</button>
|
|
<button>Cancel</button>
|
|
</div>
|
|
</code></div>
|
|
|
|
|
|
<ol>
|
|
<li>The dialog is only announced as a dialog if it takes the <code>dialog</code> ARIA role</li>
|
|
<li>The <code>aria-labelledby</code> relationship attribute makes the element carrying the <code>id</code> it points to its label</li>
|
|
<li>The close button uses <code>aria-label</code> to provide the text label “close”, overriding the text content</li>
|
|
<li>The heading is used as the dialog’s label. The <code>aria-labelledby</code> attribute points to its <code>id</code></li>
|
|
</ol>
|
|
|
|
<p>You just include <code>numbered="true"</code> on the opening shortcode tag:</p>
|
|
|
|
<pre class=""><code data-codeblock-shortcode>
|
|
{{<code numbered="true">}}
|
|
<div [[[role="dialog"]]] [[[aria-labelledby="dialog-heading"]]]>
|
|
<button [[[aria-label="close"]]]>x</button>
|
|
<h2 [[[id="dialog-heading"]]]>Confirmation</h2>
|
|
<p>Press <strong>Okay</strong> to confirm or <strong>Cancel</strong></p>
|
|
<button>Okay</button>
|
|
<button>Cancel</button>
|
|
</div>
|
|
{{</code>}}
|
|
|
|
1. The dialog is only announced as a dialog if it takes the `dialog` ARIA role
|
|
2. The `aria-labelledby` relationship attribute makes the element carrying the `id` it points to its label
|
|
3. The close button uses `aria-label` to provide the text label "close", overriding the text content
|
|
4. The heading is used as the dialog's label. The `aria-labelledby` attribute points to its `id`
|
|
</code></pre>
|
|
|
|
|
|
<h3 id="javascript-example">JavaScript example</h3>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="code-annotated numbered"><code>
|
|
/* Enable scrolling by keyboard of code samples */
|
|
(function () {
|
|
var codeBlocks = document.querySelectorAll('pre, .code-annotated');
|
|
|
|
Array.prototype.forEach.call(codeBlocks, function (block) {
|
|
if (block.querySelector('code')) {
|
|
block.setAttribute(<span class='highlight'>'role', 'region'</span>);
|
|
block.setAttribute(<span class='highlight'>'aria-label', 'code sample'</span>);
|
|
if (block.scrollWidth > block.clientWidth) {
|
|
block.setAttribute('tabindex', '0');
|
|
}
|
|
}
|
|
});
|
|
}());
|
|
</code></div>
|
|
|
|
|
|
<ol>
|
|
<li>The <code>region</code> role announces the block as a region</li>
|
|
<li>The <code>aria-label</code> describes the kind of content to be expected in the region</li>
|
|
</ol>
|
|
|
|
<aside aria-label="note" class="note">
|
|
<div>
|
|
<svg class="sign" aria-hidden="true" viewBox="0 0 41.667306 41.66729" focusable="false">
|
|
<use xlink:href="#info"></use>
|
|
</svg>
|
|
<p>As you may have noticed, using specified highlights with the <code>code</code> shortcode sacrifices syntax highlighting. If you want syntax highlighting you must use the markdown triple back-tick syntax and annotation is not available.</p>
|
|
|
|
</div>
|
|
</aside>
|
|
|
|
|
|
</div>
|
|
|
|
<div class="pattern-section">
|
|
<h1 id="demo-embedding" tabindex="-1">
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
Demo embedding
|
|
</h1>
|
|
|
|
|
|
<p>Sometimes just pictures of the pattern you’re documenting aren’t enough. Interactive patterns benefit from live demos, so that readers can test their functionality.</p>
|
|
|
|
<h2 id="codepen">CodePen</h2>
|
|
|
|
<p><strong>Cupper</strong> offers a couple of ways to do this. The first is by embedding CodePen demos into the content. The <code>codePen</code> shortcode takes just one argument: the codePen’s <code>ID</code>.</p>
|
|
|
|
<pre class=""><code data-codeblock-shortcode>
|
|
{{% codePen VpVNKW %}}
|
|
</code></pre>
|
|
|
|
|
|
<p>This will embed the identified codePen into the content wherever you placed the shortcode, with the result view showing by default:</p>
|
|
|
|
|
|
<iframe height="300" scrolling="no" title="code demonstration with codePen" src="//codepen.io/heydon/embed/VpVNKW/?height=265&theme-id=dark&default-tab=result,result&embed-version=2" frameborder="no" allowtransparency="true" allowfullscreen="true" style="width: 100%;">
|
|
<div>
|
|
<a href="//codepen.io/heydon/pen/VpVNKW">See the demo on codePen</a>
|
|
</div>
|
|
</iframe>
|
|
|
|
|
|
|
|
<aside aria-label="warning" class="note warning">
|
|
<div>
|
|
<svg class="sign" aria-hidden="true" viewBox="0 0 48.430474 41.646302" focusable="false">
|
|
<use xlink:href="#warning"></use>
|
|
</svg>
|
|
<p>The compiled site will output an error if your <code>config.toml</code> does not include your CodePen username (in the <code>codePenUser</code> parameter). This is needed to construct the embed URL.</p>
|
|
|
|
</div>
|
|
</aside>
|
|
|
|
|
|
<h2 id="jsbin">jsBin</h2>
|
|
|
|
<p>You can embed JS Bins just like CodePens, supplying a single <code>id</code> parameter.</p>
|
|
|
|
<pre class=""><code data-codeblock-shortcode>
|
|
{{% jsBin juwowaq %}}
|
|
</code></pre>
|
|
|
|
|
|
<p>However, you can also have finer control over which panes are displayed. Use two parameters: one for the <code>id</code> and another, <code>show</code>, listing the panes you want to include.</p>
|
|
|
|
<pre class=""><code data-codeblock-shortcode>
|
|
{{% jsBin id="juwowaq" show="css,output" %}}
|
|
</code></pre>
|
|
|
|
|
|
<p>The options for the <code>show</code> parameter are:</p>
|
|
|
|
<ul>
|
|
<li>html</li>
|
|
<li>css</li>
|
|
<li>js</li>
|
|
<li>console</li>
|
|
<li>output</li>
|
|
</ul>
|
|
|
|
<p>(Note that, under some circumstances, the <code>html</code> pane is added whether you select it or not.)</p>
|
|
|
|
|
|
<iframe src="https://jsbin.com/juwowaq/embed?css%2coutput" title="JS Bin demo" height="300" width="100%"></iframe>
|
|
|
|
|
|
|
|
<h2 id="inline-demos">Inline demos</h2>
|
|
|
|
<p><strong>Cupper</strong> also supports the ability to write inline demos directly in markdown files. See <a class="pattern-link" href="https://thepaciellogroup.github.io/cupper/patterns/coding/writing-inline-demos/"><svg class="bookmark" aria-hidden="true" viewBox="0 0 40 50" focusable="false"> <use xlink:href="#bookmark"></use> </svg>Writing inline demos</a>.</p>
|
|
|
|
</div>
|
|
|
|
<div class="pattern-section">
|
|
<h1 id="writing-inline-demos" tabindex="-1">
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
Writing inline demos
|
|
</h1>
|
|
|
|
|
|
<p>There are some issues with <a class="pattern-link" href="https://thepaciellogroup.github.io/cupper/patterns/coding/demo-embedding/"><svg class="bookmark" aria-hidden="true" viewBox="0 0 40 50" focusable="false"> <use xlink:href="#bookmark"></use> </svg>Demo embedding</a>, like the embeds not working offline. They also come with their own branding, which will clash with the pattern you’re trying to illustrate.</p>
|
|
|
|
<p><strong>Cupper</strong> offers another option: a special <code>demo</code> shortcode that allows you to write HTML, CSS, and JavaScript directly into the markdown file. The outputted demo is encapsulated using Shadow DOM, so you don’t have to worry about broken styles and global JS.</p>
|
|
|
|
<p>Here’s the example code for an inline demo of a toggle button:</p>
|
|
|
|
<pre class="language-html"><code class="language-html" data-codeblock-shortcode>
|
|
{{<demo>}}
|
|
<button aria-pressed="false">Toggle Me</button>
|
|
<style>
|
|
button {
|
|
background: DarkCyan;
|
|
color: white;
|
|
border: 0;
|
|
font-size: 1.5rem;
|
|
padding: 0.5em 1em;
|
|
border-right: 5px solid #000;
|
|
border-bottom: 5px solid #000;
|
|
}
|
|
|
|
[aria-pressed="true"] {
|
|
border: 0;
|
|
border-top: 5px solid #000;
|
|
border-left: 5px solid #000;
|
|
}
|
|
</style>
|
|
<script>
|
|
var toggle = demo.querySelector('[aria-pressed]');
|
|
|
|
toggle.addEventListener('click', (e) => {
|
|
let pressed = e.target.getAttribute('aria-pressed') === 'true';
|
|
e.target.setAttribute('aria-pressed', !pressed);
|
|
});
|
|
</script>
|
|
{{</demo>}}
|
|
</code></pre>
|
|
|
|
|
|
<p>Note the <code>demo.querySelector</code> on line <code>21</code>. <strong>Cupper</strong> automatically provides <code>demo</code>, representing the root node of the demo. It’s like the <code>document</code> keyword but for a demo’s subtree.</p>
|
|
|
|
<p>Here’s a live demo <em>of</em> the demo:</p>
|
|
|
|
|
|
<div class="demo-container">
|
|
|
|
<div class="demo-inner" >
|
|
<div class="demo" id="js-demo-285170a1c0812ad34ac4b853a052c8bd"></div>
|
|
<button data-launch="js-demo-285170a1c0812ad34ac4b853a052c8bd">Launch <span aria-hidden="true">↗</span></button>
|
|
</div>
|
|
|
|
|
|
<template id="template-285170a1c0812ad34ac4b853a052c8bd">
|
|
|
|
<button aria-pressed="false">Toggle Me</button>
|
|
<style>
|
|
button {
|
|
background: DarkCyan;
|
|
color: white;
|
|
border: 0;
|
|
border-radius: 0.25em;
|
|
font-size: 1.5rem;
|
|
padding: 0.5em 1em;
|
|
border-right: 5px solid #000;
|
|
border-bottom: 5px solid #000;
|
|
}
|
|
|
|
[aria-pressed="true"] {
|
|
border: 0;
|
|
border-top: 5px solid #000;
|
|
border-left: 5px solid #000;
|
|
}
|
|
</style>
|
|
<script>
|
|
var toggle = demo.querySelector('[aria-pressed]');
|
|
|
|
toggle.addEventListener('click', function () {
|
|
var pressed = this.getAttribute('aria-pressed') === 'true';
|
|
this.setAttribute('aria-pressed', !pressed);
|
|
});
|
|
</script>
|
|
|
|
</template>
|
|
<script>
|
|
(function() {
|
|
var root = document.getElementById('js-demo-285170a1c0812ad34ac4b853a052c8bd');
|
|
var template = document.getElementById('template-285170a1c0812ad34ac4b853a052c8bd');
|
|
|
|
|
|
var demoDiv = document.createElement('div');
|
|
demoDiv.innerHTML = template.innerHTML;
|
|
var standaloneScript = demoDiv.querySelector('script');
|
|
if (standaloneScript) {
|
|
standaloneScript.textContent = '(function() { document.getElementsByTagName(\'html\')[0].setAttribute(\'lang\', \'en\'); var demo = document; ' + standaloneScript.textContent + ' })();';
|
|
}
|
|
|
|
if (document.head.attachShadow) {
|
|
var templateScript = template.content.querySelector('script');
|
|
if (templateScript) {
|
|
var wrappedScript = '(function() { var demo = document.getElementById(\'js-demo-285170a1c0812ad34ac4b853a052c8bd\').shadowRoot;' + templateScript.textContent + '})();';
|
|
templateScript.textContent = wrappedScript;
|
|
}
|
|
root.attachShadow({mode: 'open'});
|
|
root.shadowRoot.appendChild(document.importNode(template.content, true));
|
|
} else {
|
|
root.innerHTML = '<p class="site-error"><strong style="font-weight:bold">Site error:</strong> A browser supporting Shadow DOM is needed to run encapsulated demos. You can launch the demo in a separate window ↓</p>';
|
|
}
|
|
|
|
var launchButton = document.querySelector('[data-launch="js-demo-285170a1c0812ad34ac4b853a052c8bd"]');
|
|
launchButton.addEventListener('click', function () {
|
|
var standalone = window.open();
|
|
standalone.document.body.innerHTML = demoDiv.innerHTML;
|
|
|
|
|
|
var newScript = standalone.document.createElement('script');
|
|
var oldScript = standalone.document.querySelector('script');
|
|
if (oldScript) {
|
|
newScript.textContent = oldScript.textContent;
|
|
oldScript.parentNode.removeChild(oldScript);
|
|
standalone.document.body.appendChild(newScript);
|
|
}
|
|
|
|
|
|
standalone.document.title = 'demo ' + "285170a1c0812ad34ac4b853a052c8bd";
|
|
});
|
|
})();
|
|
</script>
|
|
</div>
|
|
|
|
|
|
<h2 id="styling-the-container">Styling the container</h2>
|
|
|
|
<p>Sometimes your component will be expected to appear in a context where the parent element has a background color and possibly other styles. You can add style to your demo block’s container element using the <code>style</code> attribute. It works just like standard inline styling.</p>
|
|
|
|
<p><pre class="language-html"><code class="language-html" data-codeblock-shortcode>
|
|
{{<demo style="background-color: pink; padding: 1rem;">}}
|
|
<!-- demo code here -->
|
|
{{</demo>}}
|
|
</code></pre>
|
|
</p>
|
|
|
|
<h2 id="launch">“Launch”</h2>
|
|
|
|
<p>The “Launch” button takes the demo code and pushes it to a new browser tab. This serves two purposes:</p>
|
|
|
|
<ul>
|
|
<li>It provides a fallback for browsers that do not support Shadow DOM encapsulation (a warning message will replace the inline demo).</li>
|
|
<li>It creates an isolated test case for the demo, allowing you to run browser extensions and bookmarklets on the the demo code and <em>just</em> the demo code.</li>
|
|
</ul>
|
|
|
|
<aside aria-label="note" class="note">
|
|
<div>
|
|
<svg class="sign" aria-hidden="true" viewBox="0 0 41.667306 41.66729" focusable="false">
|
|
<use xlink:href="#info"></use>
|
|
</svg>
|
|
<p>The “Launch” button is positioned over the styleable demo container. Bear this is mind when styling the container (see the previous section).</p>
|
|
|
|
</div>
|
|
</aside>
|
|
|
|
|
|
<h2 id="captioned-demos">Captioned demos</h2>
|
|
|
|
<p>It’s possible to give your demo a caption using an accessible <code><figure></code> and <code><figcaption></code> structure. All <em>you</em> need to do is supply a <code>caption</code> attribute. For example:</p>
|
|
|
|
<pre class="language-html"><code class="language-html" data-codeblock-shortcode>
|
|
{{<demo caption="A basic button element">}}
|
|
<!-- demo code here -->
|
|
{{</demo>}}
|
|
</code></pre>
|
|
|
|
|
|
<p>Along with the standard <code>figure</code> shortcodes (described in <a class="pattern-link" href="https://thepaciellogroup.github.io/cupper/patterns/media/including-images/"><svg class="bookmark" aria-hidden="true" viewBox="0 0 40 50" focusable="false"> <use xlink:href="#bookmark"></use> </svg>Including images</a>), demo figures are numbered automatically according to their order in the page. You can use markdown syntax in the caption text value.</p>
|
|
|
|
</div>
|
|
|
|
<div class="pattern-section">
|
|
<h1 id="color-palettes" tabindex="-1">
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
Color palettes
|
|
</h1>
|
|
<p>There’s no reason why your <strong>Cupper</strong>-powered pattern library has to be all about functionality. You can include style guide-like information such as color palettes too. The <code>colors</code> shortcode makes it easy to exhibit colors and their values together. Just supply a comma-separated list of CSS color values.</p>
|
|
|
|
<pre class=""><code data-codeblock-shortcode>
|
|
{{% colors "#111111, #cccccc, #ffffff" %}}
|
|
</code></pre>
|
|
|
|
|
|
<p>The result is a one row strip showing each color supplied in order. The colors for <strong>Cupper</strong> are greyscale:</p>
|
|
|
|
|
|
|
|
<div class="colors-container">
|
|
<ul class="colors">
|
|
|
|
<li style="background-color: #111111;">
|
|
<span>#111111</span>
|
|
</li>
|
|
|
|
<li style="background-color: #CCCCCC;">
|
|
<span>#CCCCCC</span>
|
|
</li>
|
|
|
|
<li style="background-color: #FFFFFF; border: 1px solid #111">
|
|
<span>#FFFFFF</span>
|
|
</li>
|
|
|
|
</ul>
|
|
</div>
|
|
|
|
|
|
<aside aria-label="note" class="note">
|
|
<div>
|
|
<svg class="sign" aria-hidden="true" viewBox="0 0 41.667306 41.66729" focusable="false">
|
|
<use xlink:href="#info"></use>
|
|
</svg>
|
|
<p>If you’re wondering whether you need to put a space after the commas in the shortcode, don’t worry: <code>"#254f7b, #579a6d, #666666"</code> and <code>"#254f7b,#579a6d,#666666"</code> are both accepted. Any CSS color value is acceptable, not just hex colors.</p>
|
|
|
|
</div>
|
|
</aside>
|
|
|
|
|
|
</div>
|
|
|
|
<div class="pattern-section">
|
|
<h1 id="command-line" tabindex="-1">
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
Command line
|
|
</h1>
|
|
<p>Your pattern documentation may need to include commands for installing packages or using <abbr title="command line interface">CLI</abbr>s. <strong>Cupper</strong> offers the <code>cmd</code> shortcode for making code blocks look like terminal commands.</p>
|
|
|
|
<p>Here’s how you write it:</p>
|
|
|
|
<pre class=""><code data-codeblock-shortcode>
|
|
{{<cmd>}}
|
|
npm run start
|
|
{{</cmd>}}
|
|
</code></pre>
|
|
|
|
|
|
<p>And here’s how it looks:</p>
|
|
|
|
<pre class="cmd"><code>npm run start</code></pre>
|
|
|
|
|
|
<aside aria-label="warning" class="note warning">
|
|
<div>
|
|
<svg class="sign" aria-hidden="true" viewBox="0 0 48.430474 41.646302" focusable="false">
|
|
<use xlink:href="#warning"></use>
|
|
</svg>
|
|
<p>The <code>cmd</code> shortcode currently only supports single commands. If you want to show multiple, successive commands use separate <code>cmd</code> blocks.</p>
|
|
|
|
</div>
|
|
</aside>
|
|
|
|
|
|
</div>
|
|
|
|
<div class="pattern-section">
|
|
<h1 id="file-trees" tabindex="-1">
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
File trees
|
|
</h1>
|
|
<p>Representing folder/file structures is simple and accessible in <strong>Cupper</strong>. Which is just as well, because some components may need to conform to a certain folder structure.</p>
|
|
|
|
<p>The file tree is described using a markdown nested list structure:</p>
|
|
|
|
<pre class=""><code data-codeblock-shortcode>
|
|
{{% fileTree %}}
|
|
* Level 1 folder
|
|
* Level 2 file
|
|
* Level 2 folder
|
|
* Level 3 file
|
|
* Level 3 folder
|
|
* Level 4 file
|
|
* Level 3 folder
|
|
* Level 4 file
|
|
* Level 4 file
|
|
* Level 3 file
|
|
* Level 2 folder
|
|
* Level 3 file
|
|
* Level 3 file
|
|
* Level 3 file
|
|
* Level 2 file
|
|
* Level 1 file
|
|
{{% /fileTree %}}
|
|
</code></pre>
|
|
|
|
|
|
<p>This is drawn in the following fashion, but preserves the underlying nested list structure for assistive technologies such as screen readers:</p>
|
|
|
|
<p><div class="file-tree">
|
|
<ul>
|
|
<li>Level 1 folder
|
|
|
|
<ul>
|
|
<li>Level 2 file</li>
|
|
<li>Level 2 folder
|
|
|
|
<ul>
|
|
<li>Level 3 file</li>
|
|
<li>Level 3 folder
|
|
|
|
<ul>
|
|
<li>Level 4 file</li>
|
|
</ul></li>
|
|
<li>Level 3 folder
|
|
|
|
<ul>
|
|
<li>Level 4 file</li>
|
|
<li>Level 4 file</li>
|
|
</ul></li>
|
|
<li>Level 3 file</li>
|
|
</ul></li>
|
|
<li>Level 2 folder
|
|
|
|
<ul>
|
|
<li>Level 3 file</li>
|
|
<li>Level 3 file</li>
|
|
<li>Level 3 file</li>
|
|
</ul></li>
|
|
<li>Level 2 file</li>
|
|
</ul></li>
|
|
<li>Level 1 file</li>
|
|
</ul>
|
|
|
|
</div>
|
|
</p>
|
|
|
|
<aside aria-label="warning" class="note warning">
|
|
<div>
|
|
<svg class="sign" aria-hidden="true" viewBox="0 0 48.430474 41.646302" focusable="false">
|
|
<use xlink:href="#warning"></use>
|
|
</svg>
|
|
<p>The only reliable way to nest unordered lists in markdown is to indent the nested item by exactly four spaces. Using tabs or less than four spaces are unreliable methods.</p>
|
|
|
|
</div>
|
|
</aside>
|
|
|
|
|
|
</div>
|
|
|
|
<div class="pattern-section">
|
|
<h1 id="tested-using..." tabindex="-1">
|
|
<svg class="bookmark-icon" aria-hidden="true" viewBox="0 0 40 50" focusable="false">
|
|
<use xlink:href="#bookmark"></use>
|
|
</svg>
|
|
Tested using...
|
|
</h1>
|
|
<p>When you’re an inclusive designer, it’s pertinent to do some testing. Following specs is one thing, but you need to verify that your component works okay for users.</p>
|
|
|
|
<p><strong>Cupper</strong> provided a <code>tested</code> shortcode that lets you show which browsers and assistive technologies you’ve tried your design out in. Here’s an example. Note the commas and “+” signs.</p>
|
|
|
|
<pre class=""><code data-codeblock-shortcode>
|
|
{{% tested using="Firefox + JAWS, Chrome, Safari iOS + Voiceover, Edge" %}}
|
|
</code></pre>
|
|
|
|
|
|
<p>This outputs:</p>
|
|
|
|
|
|
|
|
|
|
<table class="tested">
|
|
<tr>
|
|
<th scope="row">
|
|
<svg viewBox="0 0 177.16535 177.16535" focusable="false" aria-hidden="true">
|
|
<use xlink:href="#tick"></use>
|
|
</svg>
|
|
Tested using
|
|
</th>
|
|
|
|
<td>
|
|
|
|
|
|
|
|
|
|
<img src="https://thepaciellogroup.github.io/cupper/images/browser-firefox.svg" alt="">
|
|
<span><strong>Firefox </strong></span>
|
|
|
|
|
|
|
|
<span class="additional">with <strong>JAWS</strong></span>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
|
|
|
|
|
|
<img src="https://thepaciellogroup.github.io/cupper/images/browser-chrome.svg" alt="">
|
|
<span><strong>Chrome </strong></span>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
|
|
|
|
|
|
<img src="https://thepaciellogroup.github.io/cupper/images/browser-safari-ios.svg" alt="">
|
|
<span><strong>Safari iOS </strong></span>
|
|
|
|
|
|
|
|
<span class="additional">with <strong>Voiceover</strong></span>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
|
|
|
|
|
|
<img src="https://thepaciellogroup.github.io/cupper/images/browser-edge.svg" alt="">
|
|
<span><strong>Edge </strong></span>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
</table>
|
|
|
|
|
|
<p>The value for the <code>using</code> attribute follows a specific format: each testing setup is separated by a comma (with a space if you like, but it’s not mandatory). If you want to add an assistive technology (or any other “add on”) this needs to follow a “+”. This additional part can be anything, like “A VR headset I borrowed”, but there are only a few browser terms available. These are case sensitive, so you need to write them as below:</p>
|
|
|
|
<ul>
|
|
<li>Firefox</li>
|
|
<li>Chrome</li>
|
|
<li>Safari</li>
|
|
<li>IE</li>
|
|
<li>Edge</li>
|
|
<li>Opera</li>
|
|
<li>Chrome Android</li>
|
|
<li>Firefox Android</li>
|
|
<li>Safari iOS</li>
|
|
</ul>
|
|
|
|
<p>Obviously, this is not a comprehensive list and more may be added over time. But it covers most of the main browsers for pairing with other software — at least for testing purposes.</p>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</main>
|
|
|
|
<footer role="contentinfo">
|
|
<div>
|
|
<label for="themer">
|
|
dark theme: <input type="checkbox" id="themer" class="vh">
|
|
<span aria-hidden="true"></span>
|
|
</label>
|
|
</div>
|
|
Powered by <strong>Cupper</strong>, a <strong>The Paciello Group</strong> project.<br>
|
|
For general enquiries, contact us on info@paciellogroup.com.
|
|
</footer>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script src="https://thepaciellogroup.github.io/cupper/js/prism.js"></script>
|
|
<script src="https://thepaciellogroup.github.io/cupper/js/dom-scripts.js"></script>
|
|
|
|
</body>
|
|
</html>
|