1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-06-28 16:48:00 +02:00

add simple styleguide page

- modify lots of typographic elements
- activate all the redcarpet extensions
This commit is contained in:
Matthias Kretschmann 2016-05-05 17:33:57 +02:00
parent c694fbb3cf
commit 3fa1227d8f
Signed by: m
GPG Key ID: BD3C1F3EDD7831FC
11 changed files with 847 additions and 54 deletions

View File

@ -40,7 +40,7 @@ future: false
markdown: redcarpet
redcarpet:
extensions: ['autolink', 'smart', 'hard_wrap']
extensions: ['autolink', 'tables', 'smart', 'hard_wrap', 'fenced_code_blocks', 'strikethrough', 'highlight', 'quote', 'footnotes', 'with_toc_data', 'space_after_headers', 'superscript']
# Generator
@ -60,7 +60,7 @@ gems:
- jekyll-picture-tag
- jekyll-paginate
- jekyll-archives
# jekyll-archives
# --------------------

View File

@ -16,12 +16,11 @@ code,
kbd
padding: 2px 4px
code
code,
samp
color: darken($code-color, 40%)
background-color: alpha($code-bg, 10%)
background-color: alpha($code-bg, 5%)
border-radius: $border-radius-base
white-space: nowrap
word-wrap: normal
kbd
color: $kbd-color
@ -49,14 +48,20 @@ pre
// Account for some code outputs that place code tags in pre tags
code
white-space: pre
overflow: auto
display: block
padding: 0
font-size: inherit
color: inherit
white-space: pre
background-color: transparent
border-radius: 0
code.bash
overflow-wrap: normal
word-wrap: normal
word-break: normal
code.language-shell
padding-left: 1.5em
display: block

View File

@ -39,4 +39,30 @@ table tbody tr:nth-child(odd) th
table tbody tr:hover td,
table tbody tr:hover th
background-color: #f5f5f5
background-color: #f5f5f5
.table-responsive
overflow-x: auto
min-height: 0.01% // Workaround for IE9 bug (see https://github.com/twbs/bootstrap/issues/14837)
@media (max-width: $screen-small-min)
width: 100%
margin-bottom: ($spacer * 0.75)
overflow-y: hidden
-webkit-overflow-scrolling: touch
-ms-overflow-style: -ms-autohiding-scrollbar
// Tighten up spacing
> table
margin-bottom: 0
// Ensure the content doesn't wrap
> thead,
> tbody,
> tfoot
> tr
> th,
> td
white-space: nowrap
padding: .5em .2em

View File

@ -191,9 +191,10 @@ list-unstyled()
.list-unstyled
list-unstyled()
nav ul,
nav ol
@extend .list-unstyled
nav
ul,
ol
@extend .list-unstyled
// Inline turns list items into inline-block
.list-inline
@ -224,12 +225,11 @@ em,
.italic
font-style: italic
cite
font-style: normal
hr
@extend .divider-bottom
border: 0
border-top: 0
border-left: 0
border-right: 0
margin-bottom: ($spacer*2)
.small
@ -238,9 +238,32 @@ hr
.mini
font-size: $font-size-mini
abbr[title],
dfn
text-transform: none
font-style: normal
font-size: inherit
border-bottom: 1px dashed $text-color-dimmed
cursor: help
font-feature-settings: inherit
mark
background: #FFFAAB
color: $text-color
sup
@extend .small
// Quotes
/////////////////////////////////////
q
@extend .italic
cite
font-style: normal
text-transform: uppercase
blockquote,
blockquote > p
@extend .italic
@ -277,6 +300,7 @@ blockquote
margin-bottom: 0
// Selection
/////////////////////////////////////

View File

@ -99,7 +99,7 @@ $border-radius-small = $border-radius-base
$border-radius-large = $border-radius-base
$padding-base-vertical = 8px
$padding-base-horizontal = 18px
$padding-base-horizontal = 12px
$padding-small-vertical = ($padding-base-vertical / 2)
$padding-small-horizontal = ($padding-base-horizontal / 2)
@ -111,7 +111,7 @@ $padding-large-horizontal = ($padding-base-horizontal * 2)
// Forms
/////////////////////////////////////
$input-bg = #fff
$input-bg = alpha(#fff, .85)
$input-bg-focus = #fff
$input-bg-disabled = $brand-grey-light

View File

@ -58,6 +58,11 @@
<link rel="stylesheet" href="/assets/css/{{ page.style }}">
{% endif %}
<!-- Prevent search indexing for some pages -->
{% if page.sitemap == false %}
<meta name="robots" content="noindex,nofollow">
{% endif %}
<!--
TypeKit
Improved snippet from https://blog.5apps.com/2014/02/21/using-typekit-the-right-way-with-an-improved-loading-script.html

View File

@ -23,7 +23,7 @@ The login data, in detail just the password is stored encrypted in the .htpasswd
Just open Terminal application and type in the following code and replace username and password with your desired data:
``` bash
```shell
htpasswd -nb username password
```

View File

@ -57,7 +57,7 @@ Alessandro has built [a nice .deb package for i386 machines](http://dl.getdropbo
Now fire up your Terminal under Applications > Accessories and execute the following lines (separately). You have to type Y for yes when Terminal asks you if it should continue:
``` bash
```shell
sudo apt-get build-dep netatalk
sudo apt-get install cracklib2-dev fakeroot libssl-dev
sudo apt-get source netatalk
@ -68,7 +68,7 @@ Now you have downloaded the source code of Netatalk to your home folder, install
Next you have to build the Netatalk package with the encryption option enabled:
``` bash
```shell
sudo DEB_BUILD_OPTIONS=ssl dpkg-buildpackage -rfakeroot
```
@ -79,13 +79,13 @@ Depending on your hardware this may take a while but you can enjoy the geeky bui
If everything went through without errors (except the signing warnings, can be ignored) you can install the recently created package:
``` bash
```shell
sudo dpkg -i ~/netatalk_2*.deb
```
To stop Ubuntu from overwriting your custom Netatalk package you should set its state to hold. This will cause the Netatalk package being grayed out in the Software Update dialogue:
``` bash
```shell
echo "netatalk hold" | sudo dpkg --set-selections
```
@ -93,13 +93,13 @@ Now you have successfully build and installed your custom Netatalk package which
# 2. Configure Netatalk
![Netatalk icon](/media/netatalk.png)First you should deactivate services provided by Netatalk which are not needed if you just want to use your Ubuntu box for file sharing. This will speed up the response and startup time of Netatalk dramatically. For instance Netatalk starts the old AppleTalk protocol by default which is just needed for pre OS X systems. So we're going to use the graphical editor gedit for stopping unneeded services:
![Netatalk icon](/media/netatalk.png)First you should deactivate services provided by Netatalk which are not needed if you just want to use your Ubuntu box for file sharing. This will speed up the response and startup time of Netatalk dramatically. For instance Netatalk starts the old AppleTalk protocol by default which is just needed for pre OS X systems. So we're going to use the graphical editor vi for stopping unneeded services:
``` bash
sudo gedit /etc/default/netatalk
```shell
sudo vi /etc/default/netatalk
```
gedit should pop up with the defined file loaded as superuser (needed for saving). Find the "#Set which daemons to run" part and replace the default values with these to enable just AFP and disable all unneeded services. Let the cnid_meta daemon run too and if you want to [share your Linux connected printer with your Mac](http://www.zaphu.com/2008/04/29/ubuntu-guide-configure-netatalk-to-share-a-usb-printer/) also enable the pap daemon (set to yes):
vim should pop up with the defined file loaded as superuser (needed for saving). Find the "#Set which daemons to run" part and replace the default values with these to enable just AFP and disable all unneeded services. Let the cnid_meta daemon run too and if you want to [share your Linux connected printer with your Mac](http://www.zaphu.com/2008/04/29/ubuntu-guide-configure-netatalk-to-share-a-usb-printer/) also enable the pap daemon (set to yes):
```
ATALKD_RUN=no
@ -114,8 +114,8 @@ Here it's very important to run the cnid_meta daemon because this service will h
Press Ctrl + S to save the document or choose File > Save. Next we have to edit the main config file for AFP sharing called afpd.conf:
``` bash
sudo gedit /etc/netatalk/afpd.conf
```shell
sudo vi /etc/netatalk/afpd.conf
```
Scroll to the very bottom of the document and add this to the bottom (replace the whole line in case there's already one). This is one line so be sure that there's no line break in your afpd.conf file:
@ -128,10 +128,10 @@ Press Ctrl + S to save the document or choose File > Save.
# 3. Configure shared Volumes
![Time Machine Volume icon](/media/timemachinedisk97.png)Now we have to tell the afpd daemon what Volumes to share. This is defined in the AppleVolumes.default file inside /etc/netatalk/. The following line will open this file in the gedit editor with superuser privileges (required for saving) where we can define our shared volumes:
![Time Machine Volume icon](/media/timemachinedisk97.png)Now we have to tell the afpd daemon what Volumes to share. This is defined in the AppleVolumes.default file inside /etc/netatalk/. The following line will open this file in vim with superuser privileges (required for saving) where we can define our shared volumes:
``` bash
sudo gedit /etc/netatalk/AppleVolumes.default
```shell
sudo vi /etc/netatalk/AppleVolumes.default
```
Scroll to the bottom of the document and define your Volume shares. By adding the following line you will share each users home directory with the user name as the Volume name. To make things more secure you can define all users who are allowed to connect to your Ubuntu box via AFP:
@ -158,7 +158,7 @@ Press Ctrl + S to save the document or choose File > Save. Of course you can def
Finally restart Netatalk to activate the changes:
``` bash
```shell
sudo /etc/init.d/netatalk restart
```
@ -169,15 +169,15 @@ Although we now have a fully configured AFP file server it will not show up in t
![Bonjour icon](/media/bonjour97.png)So the Avahi daemon will advertise all defined services across your network just like Bonjour do. So let's install the avahi daemon and the mDNS library used for imitating the Bonjour service. When fully configured this will cause all Macs in your network to discover your Ubuntu box automatically:
``` bash
```shell
sudo apt-get install avahi-daemon
sudo apt-get install libnss-mdns
```
To make everything work properly you have to edit the nsswitch.conf file:
``` bash
sudo gedit /etc/nsswitch.conf
```shell
sudo vi /etc/nsswitch.conf
```
Just add "mdns" at the end of the line that starts with "hosts:". Now the line should look like this:
@ -192,13 +192,13 @@ Press Ctrl + S to save the document or choose File > Save.
![Bonjour icon](/media/bonjour97.png)Next we have to tell Avahi which services it should advertise across the network. In our case we just want to advertise AFP sharing. This is done by creating a xml-file for each service inside /etc/avahi/services/ following a special syntax. Let's create a xml-file for the afpd service with the following line:
```bash
sudo gedit /etc/avahi/services/afpd.service
```shell
sudo vi /etc/avahi/services/afpd.service
```
A blank document should open in gedit. Now paste the following into the document and save the file by pressing Ctrl + S or by choosing File > Save:
A blank document should open in vim. Now paste the following into the document and save the file by pressing Ctrl + S or by choosing File > Save:
``` xml
```xml
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
@ -219,7 +219,7 @@ update: The last part is used to assign a specific (Apple) hardware model to you
Finally restart the avahi daemon to activate all changes:
``` bash
```shell
sudo /etc/init.d/avahi-daemon restart
```
@ -241,7 +241,7 @@ update: If you've followed the revised version of this article your Linux box sh
![Time Machine icon](/media/timemachine97.png)**update 07/14/2008:** On the Mac side you have to enable the option to use network volumes as Time Machine drives first. Without it your freshly shared and advertised network volume won't show up in the disk selection dialogue in Time Machine. This is a hidden option not accessible via the graphical user interface so you have to copy & paste this in Terminal (it's one line):
``` bash
```shell
defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
```
@ -267,13 +267,13 @@ Finally the only problem remaining is that your Ubuntu or Linux box isn't format
## Problems with creating the backup disk image
If time Machine says "The backup disk image could not be created" during the first backup attempt you can do the following to avoid this problem and some others (backup fail due to permissions):
If Time Machine says "The backup disk image could not be created" during the first backup attempt you can do the following to avoid this problem and some others (backup fail due to permissions):
In short, you have to create the backup disk image on your Desktop and copy it to your mounted Time Machine volume. But Time Machine creates a unique filename for the disk image and we can find out this name with a little trick:
First open up the Console from your Applications > Utilities folder and open the Time Machine preferences. In Time Machine preferences set your backup volume back to none. After that reselect your mounted Time Machine volume. The counter should start and Time Machine's big button will change to on. When the backup tries to start and fail have a look at your Console (Click All Messages in the sidepane). There should be a line telling you the name of the disk image:
``` bash
```shell
Creating disk image /Volumes/TimeMachine/computername_0014e3856bd0.sparsebundle
```
@ -315,8 +315,8 @@ Remember that this error can be caused by a myriad of problems and just a lot of
If you still can't connect to your Ubuntu box you can edit your /etc/hosts file as [I've pointed out in the comments](http://www.kremalicious.com/2008/06/ubuntu-as-mac-file-server-and-time-machine-volume/#comment-417):
``` bash
sudo gedit /etc/hosts
```shell
sudo vi /etc/hosts
```
Add the following two lines at the very top of the file.
@ -338,7 +338,7 @@ But for those people still having problems with these error messages: On Mac OS
Some people have problems when connecting to an AFP share and get a -5014 error. [As J5 pointed out in the comments](http://www.kremalicious.com/2008/06/ubuntu-as-mac-file-server-and-time-machine-volume/#comment-5021) you have to delete the hidden .AppleDB folders on your Ubuntu box and restart netatalk afterwards:
``` bash
```shell
sudo /etc/init.d/netatalk restart
```
@ -346,13 +346,13 @@ sudo /etc/init.d/netatalk restart
In case of a full system restore you would have to boot your Mac from the Mac OS X installation DVD (the one delivered with your Mac) by pressing the c key during boot. Your Mac will start with a minimal UI where you have a Utilities section in the top menu bar. There you'll find "Restore from a Time Machine Backup" but it won't find your network share with your Time Machine backup. Luckily [Dmitry Nedospasov found a way to manage this](http://nedos.net/2008/03/29/restore-from-an-unsupported-time-machine-backup-with-the-leopard-dvd/) by simply mounting your Time Machine network share with the Terminal (which you can find under Utilities in the menu bar too) by utilizing the following syntax (shamelessly copied from [Dmitry](http://nedos.net/2008/03/29/restore-from-an-unsupported-time-machine-backup-with-the-leopard-dvd/)):
``` bash
```shell
mount -t afp afp://username:password@hostname/ShareName /Volumes/ShareMount
```
Replace everything instead of /Volumes with your matching names. You can test if your network share was properly mounted by doing
``` bash
```shell
ls /Volumes
```

View File

@ -31,13 +31,13 @@ Contrary to the weirdly outdated [install instructions on Tor's website](https:/
In your Terminal execute:
```bash
```shell
brew install tor
```
Then you can start it up by running:
```bash
```shell
tor
```
@ -91,7 +91,7 @@ sudo networksetup -setsocksfirewallproxystate $INTERFACE off
Save this script under something like `tor.sh` in one of your sourced `bin` folders and use it as a replacement for the general `tor` command. So you can just run
```bash
```shell
tor.sh
```

View File

@ -48,13 +48,13 @@ Because of varying copy resulting in different badge widths, the only way to mak
Install with npm:
```bash
```shell
npm i appstorebadges --save
```
Or install with Bower:
```bash
```shell
bower install appstorebadges --save
```

733
_src/styleguide.md Normal file
View File

@ -0,0 +1,733 @@
---
layout: page
title: Style Guide
sitemap: false
---
The main page title of this guide is an `h1` element.
## Sections
The secondary header above is an `h2` element, which may be used for any form of important page-level header. Consider using an `h2` unless you need a header level of less importance, or as a sub-header to an existing `h2` element.
### Third-Level Header
The header above is an `h3` element, which may be used for any form of page-level header which falls below the `h2` header in a document hierarchy.
#### Fourth-Level Header
The header above is an `h4` element, which may be used for any form of page-level header which falls below the `h3` header in a document hierarchy.
##### Fifth-Level Header
The header above is an `h5` element, which may be used for any form of page-level header which falls below the `h4` header in a document hierarchy.
###### Sixth-Level Header
The header above is an `h6` element, which may be used for any form of page-level header which falls below the `h5` header in a document hierarchy.
## Structural Elements
### Paragraphs
All paragraphs are wrapped in `p` tags. Additionally, `p` elements can be wrapped with a `blockquote` element if the `p` element is indeed a quote.
### Blockquotes
The `blockquote` element represents a section that is being quoted from another source:
> Many forms of Government have been tried, and will be tried in this world of sin and woe. No one pretends that democracy is perfect or all-wise. Indeed, it has been said that democracy is the worst form of government except all those other forms that have been tried from time to time.
>
> --- Winston Churchill, in [a speech to the House of Commons](http://hansard.millbanksystems.com/commons/1947/nov/11/parliament-bill#column_206) (11th November 1947)
### Horizontal Rules
The `hr` element represents a paragraph-level thematic break, e.g. a scene change in a story, or a transition to another topic within a section of a reference book. The following extract from *Pandora's Star* by Peter F. Hamilton shows two paragraphs that precede a scene change and the paragraph that follows it:
> Dudley was ninety-two, in his second life, and fast approaching time for another rejuvenation. Despite his body having the physical age of a standard fifty-year-old, the prospect of a long degrading campaign within academia was one he regarded with dread. For a supposedly advanced civilization, the Intersolar Commonwearth could be appallingly backward at times, not to mention cruel.
>
> *Maybe it won't be that bad*, he told himself. The lie was comforting enough to get him through the rest of the night's shift.
>
> * * *
>
> The Carlton AllLander drove Dudley home just after dawn. Like the astronomer, the vehicle was old and worn, but perfectly capable of doing its job. It had a cheap diesel engine, common enough on a semi-frontier world like Gralmond, although its drive array was a thoroughly modern photoneural processor. With its high suspension and deep-tread tyres it could plough along the dirt track to the observatory in all weather and seasons, including the metre-deep snow of Gralmond's winters.
## List Elements
### Ordered Lists
The `ol` element denotes an ordered list, and various numbering schemes are available through CSS (including 1,2,3... i,ii,iii... a,b,c... and so on). Each item requires a surrounding `li` tag, to denote individual items within the list.
Here is an example list showing the monarchs of Great Britain and the United Kingdom:
1. House of Stuart
1. Anne
2. House of Hanover
1. George I
2. George II
3. George III
4. George IV
5. William IV
6. Victoria
3. House of Saxe-Coburg and Gotha
1. Edward VII
4. House of Windsor
1. George V
2. Edward VIII
3. George VI
4. Elizabeth II
### Unordered Lists
The `ul` element denotes an unordered list (i.e. a list of loose items that don't require numbering, or a bulleted list). Again, each item requires a surrounding `li` tag, to denote individual items.
Here is an example list showing the constituent parts of the British Isles:
* United Kingdom of Great Britain and Northern Ireland:
* England
* Scotland
* Wales
* Northern Ireland
* Republic of Ireland
* Isle of Man
* Channel Islands:
* Bailiwick of Guernsey
* Bailiwick of Jersey
Sometimes you may want each list item to contain block elements, typically a paragraph or two:
* The British Isles is an archipelago consisting of the two large islands of Great Britain and Ireland, and many smaller surrounding islands.
* Great Britain is the largest island of the archipelago. Ireland is the second largest island of the archipelago and lies directly to the west of Great Britain.
* The full list of islands in the British Isles includes over 1,000 islands, of which 51 have an area larger than 20 km^2^.
### Definition Lists
The `dl` element is for another type of list called a definition list. Instead of list items, the content of a `dl` consists of `dt` (definition term) and `dd` (definition description) pairs. Though it may be called a "definition list", `dl` can apply to other scenarios where a parent/child relationship is applicable. For example, it may be used for marking up dialogues, with each `dt` naming a speaker, and each `dd` containing his or her words:
Romeo
: Have not saints lips, and holy palmers too?
Juliet
: Ay, pilgrim, lips that they must use in prayer.
## Table Elements
Tables should be used when displaying tabular data. The `thead`, `tfoot` and `tbody` elements enable you to group rows within each table.
If you use these elements, you must use every element. They should appear in this order: `thead`, `tfoot` and `tbody`, so that browsers can render the foot before receiving all the data. You must use these tags within the `table` element.
Example with Team GB's London 2012 medal table:
<div class="table-responsive">
<table>
<thead>
<tr>
<th style="text-align: left">Sport</th>
<th>Gold</th>
<th>Silver</th>
<th>Bronze</th>
<th>Total</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">Athletics</td>
<td>4</td>
<td>1</td>
<td>1</td>
<td>6</td>
</tr>
<tr>
<td style="text-align: left">Boxing</td>
<td>3</td>
<td>1</td>
<td>1</td>
<td>5</td>
</tr>
<tr>
<td style="text-align: left">Canoe Slalom</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>2</td>
</tr>
<tr>
<td style="text-align: left">Canoe Sprint</td>
<td>1</td>
<td>0</td>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td style="text-align: left">Cycling - Road</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>3</td>
</tr>
<tr>
<td style="text-align: left">Cycling - Track</td>
<td>7</td>
<td>1</td>
<td>1</td>
<td>9</td>
</tr>
<tr>
<td style="text-align: left">Diving</td>
<td>0</td>
<td>0</td>
<td>1</td>
<td>1</td>
</tr>
<tr>
<td style="text-align: left">Equestrian</td>
<td>3</td>
<td>1</td>
<td>1</td>
<td>5</td>
</tr>
<tr>
<td style="text-align: left">Gymnastics - Artistic</td>
<td>0</td>
<td>1</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td style="text-align: left">Hockey</td>
<td>0</td>
<td>0</td>
<td>1</td>
<td>1</td>
</tr>
<tr>
<td style="text-align: left">Judo</td>
<td>0</td>
<td>1</td>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td style="text-align: left">Modern Pentathlon</td>
<td>0</td>
<td>1</td>
<td>0</td>
<td>1</td>
</tr>
<tr>
<td style="text-align: left">Rowing</td>
<td>4</td>
<td>2</td>
<td>3</td>
<td>9</td>
</tr>
<tr>
<td style="text-align: left">Sailing</td>
<td>1</td>
<td>4</td>
<td>0</td>
<td>5</td>
</tr>
<tr>
<td style="text-align: left">Shooting</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>1</td>
</tr>
<tr>
<td style="text-align: left">Swimming</td>
<td>0</td>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td style="text-align: left">Tennis</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>2</td>
</tr>
<tr>
<td style="text-align: left">Taekwondo</td>
<td>1</td>
<td>0</td>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td style="text-align: left">Triathlon</td>
<td>1</td>
<td>0</td>
<td>1</td>
<td>2</td>
</tr>
</tbody>
<tfoot>
<tr>
<td style="text-align: left">Total</td>
<td>29</td>
<td>17</td>
<td>19</td>
<td>65</td>
</tr>
</tfoot>
</table>
</div>
## Media Elements
### Image
The `img` element represents an image:
<img src="/media/obligatory-it-s-summer-in-berlin-photo.jpg" alt="Example image" width="600" height="360" />
## Text Formatting Elements
### Links and Anchors
The `a` element is used to hyperlink text, be that to another page, a named fragment on the current page or any other location on the web. Example:
[Go to the home page](/) or [return to the top of this page](#top).
### Stressed Emphasis
The `em` element is used to denote text with stressed emphasis, i.e. something you'd pronounce differently. Where italicizing is required for stylistic differentiation, the `i` element may be preferable. Example:
You simply *must* try the negitoro maki!
### Strong Importance
The `strong` element is used to denote text with strong importance. Where bolding is used for stylistic differentiation, the `b` element may be preferable. Example:
**Don't** stick nails in the electrical outlet.
### Italicised
The `i` element is used for text in an alternate voice or mood, or otherwise offset from the normal prose. Examples include taxonomic designations, technical terms, idiomatic phrases from another language, the name of a ship or other spans of text whose typographic presentation is typically italicised. Example:
There is a certain <i>je ne sais quoi</i> in the air.
### Emboldened
The `b` element is used for text stylistically offset from normal prose without conveying extra importance, such as key words in a document abstract, product names in a review, or other spans of text whose typographic presentation is typically emboldened. Example:
You enter a small room. Your <b>sword</b> glows brighter. A **rat** scurries past the corner wall.
### Inline Quotes
The `q` element is used for quoting text inline. Example showing nested quotations:
John said, <q>I saw Lucy at lunch, she told me <q>Mary wants you to get some ice cream on your way home</q>. I think I will get some at Ben and Jerry's, on Gloucester Road.</q>
### Abbreviations
The `abbr` element is used for any abbreviated text, whether it be acronym, initialism, or otherwise. Generally, it's less work and useful (enough) to mark up only the first occurrence of any particular abbreviation on a page, and ignore the rest. Any text in the `title` attribute will appear when the user's mouse hovers the abbreviation (although, notably, this does not work in Internet Explorer for Windows). Example:
Get the latest news from the <abbr title="British Broadcasting Corporation">[BBC](http://www.bbc.co.uk/)</abbr> in Stoke and <abbr title="Staffordshire">Staffs</abbr>.
### Definitions
The `dfn` element is used to highlight the first use of a term. The `title` attribute can be used to describe the term. Example:
Bob's <dfn title="Dog">canine</dfn> mother and <dfn title="Horse">equine</dfn> father sat him down and carefully explained that he was an <dfn title="A mutation that combines two or more sets of chromosomes from different species">allopolyploid</dfn> organism.
### Citations
The `cite` element is used to represent the title of a work (e.g. a book, essay, poem, song, film, TV show, sculpture, painting, musical, exhibition, etc.). This can be a work that is being quoted or referenced in detail (i.e. a citation), or it can just be a work that is mentioned in passing. Example:
<cite>Universal Declaration of Human Rights</cite>, United Nations, December 1948. Adopted by General Assembly resolution 217 A (III).
### Marked or Highlighted Text
The `mark` element is used to represent a run of text marked or highlighted for reference purposes. When used in a quotation it indicates a highlight not originally present but added to bring the reader's attention to that part of the text. When used in the main prose of a document, it indicates a part of the document that has been highlighted due to its relevance to the user's current activity. Example:
I also have some ==kitten==s who are visiting me these days. They're really cute. I think they like my garden! Maybe I should adopt a ==kitten==.
### Edits
The `del` element is used to represent deleted or retracted text which still must remain on the page for some reason. Meanwhile its counterpart, the `ins` element, is used to represent inserted text. Example:
As a result, ~~Kodos~~ ++Kang++ was elected president.
### Variables
The `var` element is used to denote a variable in a mathematical expression or programming context, but can also be used to indicate a placeholder where the contents should be replaced with your own value. Example:
If there are <var>n</var> pipes leading to the ice cream factory then I expect at *least* <var>n</var> flavours of ice cream to be available for purchase!
### Superscript and Subscript Text
The `sup` element represents a superscript and the sub element represents a `sub`. These elements must be used only to mark up typographical conventions with specific meanings, not for typographical presentation. As a guide, only use these elements if their absence^superscript would change the meaning of the content.
Chemical formulas are written using subscripts (e.g. C~6~H~12~O~6~), but atomic isotopes are written using superscripts (e.g. ^13 C, ^131^I, and ^238^U).
### Small Print
The `small` element is used to represent disclaimers, caveats, legal restrictions, or copyrights (commonly referred to as 'small print'). It can also be used for attributions or satisfying licensing requirements. Example:
<small>Copyright (C) 1912-2012 Acme Corporation. All Rights Reserved.</small>
### Time
The `time` element is used to represent either a time on a 24 hour clock, or a precise date in the proleptic Gregorian calendar, optionally with a time and a time-zone offset. Example:
Queen Elizabeth II was proclaimed sovereign of each of the Commonwealth realms on <time datetime="1952-02-06">6</time> and <time datetime="1952-02-07">7 February 1952</time>, after the death of her father, King George VI.
### Keyboard Entry
The `kbd` element is used to denote user input (typically via a keyboard, although it may also be used to represent other input methods, such as voice commands). Example:
To take a screenshot on your Mac, press <kbd>Cmd</kbd> + <kbd>Shift</kbd> + <kbd>3</kbd>.
### Sample Output
The `samp` element is used to represent (sample) output from a program or computing system. Useful for technology-oriented sites, not so useful otherwise. Example:
The computer said <samp>Too much cheese in tray two</samp> but I didn't know what that meant.
### Pre-Formatted Text
The `pre` element represents a block of pre-formatted text, in which structure is represented by typographic conventions rather than by elements. Here's an example showing the printable characters of ASCII:
! " # $ % & ' ( ) * + , - . /
0 1 2 3 4 5 6 7 8 9 : ; < = > ?
@ A B C D E F G H I J K L M N O
P Q R S T U V W X Y Z [ \ ] ^ _
a b c d e f g h i j k l m n o p
q r s t u v w x y z { | } ~
### Code
The `code` element is used to represent fragments of computer code. Useful for technology-oriented sites, not so useful otherwise. Example:
The [`requestAnimationFrame`](https://developer.mozilla.org/en/docs/Web/API/window.requestAnimationFrame) method in the `window` object tells the browser that you wish to perform an animation and requests that the browser call a specified function to update an animation before the next repaint.
### Code Blocks
The `code` element can also be used in conjunction with the `pre` element to represent verbatim text like markup or a fragment of computer code:
```
function microsoftShuffle(arr) {
return arr.slice().sort(function () {
return (0.5 - Math.random());
});
}
```
You may also specify the language of a code block, so that it can be properly highlighted. Below you can find the classic *Hello world* program implemented in different languages.
#### JavaScript
```js
console.log('Hello, world!');
```
#### HTML
```html
<h1 class="hello">Hello, world!</h1>
```
#### CSS
```css
.hello { font-size: 2rem; }
```
#### Shell
```shell
echo 'Hello, world!'
```
#### Bash
```bash
# output stuff
echo 'Hello, world!'
```
#### PHP
```php
<?= 'Hello, world!' ?>
```
#### C
```c
#include <stdio.h>
int main(int argc, char *argv[])
{
printf("Hello, world!\n");
return 0;
}
```
#### C++
```cpp
#include <iostream>
using namespace std;
int main()
{
cout << "Hello, world!" << endl;
return 0;
}
```
#### C&#35;
```csharp
using System;
class Program
{
public static void Main()
{
Console.WriteLine("Hello, world!");
}
}
```
#### Clojure
```clj
(println "Hello, world!")
```
#### Elixir
```elixir
IO.puts "Hello World"
```
#### Erlang
```erlang
io:format("~s~n", ["Hello, world!"])
```
#### Go
```go
package main
import "fmt"
func main() {
fmt.Println("Hello, world!")
}
```
#### Groovy
```groovy
println "Hello, world!"
```
#### Haskell
```hs
main = putStrLn "Hello, world!"
```
#### Java
```java
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, world!");
}
}
```
#### Lisp
```lisp
(princ "Hello, world!")
```
#### Lua
```lua
print("Hello, World!")
```
#### Objective-C
```objc
#import <stdio.h>
int main(void)
{
printf("Hello, world!\n");
return 0;
}
```
#### Perl
```perl
print "Hello, world!";
```
#### Python
```py
print "Hello, world!"
```
#### R
```r
cat('Hello, world!')
```
#### Ruby
```rb
puts "Hello, world!"
```
#### Scala
```scala
object HelloWorld extends App {
println("Hello, world!")
}
```
#### Scheme
```scheme
(display "Hello, world!")
```
#### Smalltalk
```smalltalk
Transcript show: 'Hello, world!'.
```
## Form Elements
Forms can be used when you wish to collect data from users. The `fieldset` element enables you to group related fields within a form, and each one should contain a corresponding `legend`. The `label` element ensures field descriptions are associated with their corresponding form widgets.
<form action="#">
<div class="form-group">
<label for="text">Text <abbr title="Required">*</abbr></label>
<input class="form-control" type="text" id="text" required="required" />
</div>
<div class="form-group">
<label for="textph">Text with placeholder</label>
<input class="form-control" type="text" id="textph" placeholder="Placeholder" />
</div>
<div class="form-group">
<label for="password">Password</label>
<input class="form-control" type="password" id="password" />
</div>
<div class="form-group">
<label for="email">Email</label>
<input class="form-control" type="email" id="email" />
</div>
<div class="form-group">
<label for="url">URL</label>
<input class="form-control" type="url" id="url" />
</div>
<div class="form-group">
<label for="number">Number</label>
<input class="form-control" type="number" id="number"
min="0" max="10" step="2" value="10" />
</div>
<div class="form-group">
<label for="range">Range</label>
<input class="form-control" type="number" id="range"
min="0" max="10" step="2" value="10" />
</div>
<div class="form-group">
<label for="date">Date</label>
<input class="form-control" type="date" id="date" />
</div>
<div class="form-group">
<label for="datetime">Date + Time</label>
<input class="form-control" type="datetime" id="datetime" />
</div>
<div class="form-group">
<label for="search">Search</label>
<input class="form-control" type="search" id="search" />
</div>
<div class="form-group">
<label for="searchph">Search with placeholder</label>
<input class="form-control" type="search" id="searchph" placeholder="Placeholder" />
</div>
<div class="form-group">
<label for="color">Color</label>
<input class="form-control" type="color" id="color" />
</div>
<div class="form-group">
<label for="textarea">Textarea</label>
<textarea class="form-control" id="textarea" rows="3"></textarea>
</div>
<div class="form-group">
<label for="textareaph">Textarea with placeholder</label>
<textarea class="form-control" id="textareaph" rows="3" placeholder="Placeholder"></textarea>
</div>
<div class="form-group">
<label for="select">Select</label>
<select class="form-control" id="select">
<optgroup label="Option Group One">
<option>Option One</option>
<option>Option Two</option>
<option>Option Three</option>
</optgroup>
<optgroup label="Option Group Two">
<option>Option Four</option>
<option>Option Five</option>
</optgroup>
</select>
</div>
<div class="buttons">
<button class="btn btn-primary" type="submit">Post Comment</button>
<button class="btn">Preview</button>
</div>
</form>
## Patterns
Design and mark-up patterns unique to this site.
### Pagination
<nav class="paginator">
<a class="paginator__link" href="/">
<svg class="icon icon-entypo icon-entypo-chevron-left">
<use xlink:href="/assets/img/sprite.svg#entypo-chevron-left"></use>
</svg>
</a>
<a href="/" class="paginator__link">1</a>
<a href="#" class="paginator__link active">2</a>
<a class="paginator__link" href="/page/3">3</a>
<a class="paginator__link" href="/page/4">4</a>
<a class="paginator__link" href="/page/5">5</a>
<a class="paginator__link" href="/page/6">6</a>
<a class="paginator__link" href="/page/7">7</a>
<a class="paginator__link" href="/page/8">8</a>
<a class="paginator__link" href="/page/9">9</a>
<a class="paginator__link" href="/page/10">10</a>
<a class="paginator__link" href="/page/11">11</a>
<a class="paginator__link" href="/page/12">12</a>
<a class="paginator__link" href="/page/3">
<svg class="icon icon-entypo icon-entypo-chevron-right">
<use xlink:href="/assets/img/sprite.svg#entypo-chevron-right"></use>
</svg>
</a>
</nav>