Editorial guidelines for i18n docs

The W3C Internationalization Activity uses github for document development. This page provides guidelines to help people contribute content that matches the standard styling and keeps the documents in a state that keeps the publication process straightforward.

The i18n WG works with 3 main types of page: article pages, site pages such as this one, and respec documents. They each use different javascript and style files.

If you have comments or suggestions about how to improve this page, feel free to raise a Github issue.

See also the guidelines for working with github.

General principles for editing HTML

You should always bear in mind the following when creating content:

We recommend adding the standard i18n CSS rules in a file called local.css. These rules can be found below.

Important: Only make minimal changes to the source code. If you commit an update that has lots of formatting changes in the source code, it obscures the actual substantive changes in the github diff. You must use an editor that doesn't automatically re-layout the source text each time you make changes. If you do want to tidy the source text, do so as a separate commit, with no substantive changes applied, and describe the commit so that people are aware that it is just a source tidy.

General markup guidelines

Javascript & CSS files

New articles must include the following:

  1. javascript/doc-structure/article-2022.js
  2. javascript/articletoc-2022.js
  3. style/article-2022.css

New site pages must include the following:

  1. /i18n-drafts/javascript/doc-structure/sitepage-2022.js
  2. /i18n-drafts/javascript/articletoc-2022.js
  3. /i18n-drafts/style/sitepage-2022.css

New articles and site pages with syntax highlighting must include the following:

  1. javascript/prism.js
  2. style/prism.css

We use relative links so that pages can be viewed without an internet connection.

Respec provides the appropriate scripting and styling when working in that context.

Source code

It isn't required, but it's easier to find things in the source code if you leave several blank lines before each section tag, and single blank lines between block elements such as p, figure, blockquote, etc.

Headings

Do not supply numbering for section headings. These will be provided automatically by scripting.

An h1..h6 element should be used for headings, and should always be a direct child of a section element. The section element should have an id. The h* element should not have a link around the heading (self links are added automatically by scripting).

<section id="mylinkid">
<h3>My header text</h3>
...
</section>

The current styling for TR documents makes it often difficult for readers to quickly find section headings. Use the styling suggested below in your local.css file in order to open up the space between sections.

To refer to a section from the text

In Respec: use[[[#section_id]]], where section_id is the id of the section you are pointing to. (An alternative is to use <a href="#section_id"></a>, but the previous approach is better because you are able to see the id in wysiwyg source or if the link fails.)

In i18n articles: use <a class="secref">section_id</a>, where section_id is the id of the section you are pointing to. (Only works with articles that use the latest javascript includes.)

The paragraph containing the pointer will be updated automatically with a link to the section you are pointing to, and the link text will be the section heading.

Figures

Put pictures, tables, examples, and the like in figure markup. Use the figcaption element when you want a caption. (Caption use is encouraged.)

To refer to a figure from the text

In Respec: use [[[#figure_id]]], where figure_id is the id of the figure you are pointing to. (An alternative is to use <a href="#figure_id"></a>, but the previous approach is better because you are able to see the id in wysiwyg source.)

In i18n articles: use <a class="figref">figure_id</a>, where figure_id is the id of the figure you are pointing to. (Only works with articles that use the latest javascript includes.)

In both cases, the markup will be replaced by a link to 'Figure XX' when the page is viewed. The Figure number will be updated automatically as new figures are added.

Notes

To create a block-type note add class="note" to the paragraph if a single para note, or use a div class="note" around the note if it contains multiple paras or blocks.

For editor's notes, put class="issue" on a p, div or span around the text you want to be the editor's note.

Run-in headings

Sometimes it's not necessary to create a new section and heading, but you may want to highlight a word or sentence at the start of a series of paragraphs. To do this, use the following markup.

<span class="leadin">highlighted text goes here</span> Rest of paragraph follows...

Abbreviations and acronyms

Use the abbr element for both of these. Spell out the full form in the title attribute.

Syntax highlighting

In Respec: use triple-backticks to create code blocks.

```css
p { color: red }
```

In i18n articles and site pages: use a pre element with a code element inside to mark up a code block for syntax highlighting, like so:

<pre><code class="language-css">p { color: red }</code></pre>

Inline code snippets are done like this:

<code class="language-css">p { color: red }</code>

Note: you have to escape all < and & characters inside code elements (code blocks and inline snippets) with &lt; and &amp; respectively. If you have large portions of HTML code, you can use the Unicode code converter to escape these characters.

Lists

A colon should be used for a sentence that leads into the list.

If a list is expressed as a single sentence each list item should begin with a lower case letter and end with a comma or ", and".  The last list item should end with a full stop.

Example:

Every W3C specification MUST:

  1. conform to the requirements applicable to specifications,
  2. specify that implementations MUST conform to the requirements applicable to software, and
  3. specify that content created according to that specification MUST conform to the requirements applicable to content.

Otherwise, each list element should begin with an uppercase letter and end with a full stop.

Example

Some aspects of Unicode that require additional specification for the Web include:

  • Choice of encoding forms (UTF-8, UTF-16, UTF-32).
  • Counting characters, measuring string length in the presence of variable-length encodings and combining characters).
  • Duplicate encodings (e.g. precomposed vs decomposed).
  • Use of control codes for various purposes (e.g. bidirectionality control, symmetric swapping, etc.).

Change markup

To show changes to the text use ins and del. However, remember that if you do commits carefully, such markup is not needed. People will be able to see the changes by looking at the diff for the commit on the Github site.

Marking up inline content

The following table suggests conventions for marking up inline content. The presentation column applies to the English version. Any translated version may change the presentation (eg. a Japanese version may substitute underlining for bold).

Type of in-line content Example Markup to use
emphasis (general) In keyboard input it is not always the case that... em
emphasis (stronger) you must absolutely not do that! strong
new term introduction The set of characters is called a repertoire. dfn id="def_<termName>" title="<termName>"
reference to a term definition The repertoire of UTF-8 includes all characters you're likely to need. a class="termref" href="#def_<termName>"
document title see Requirements for String Identity Matching. cite
quoted term The word character is used in many contexts. span class="qterm"
quoted term / phrase expressing dubious usage ie. numeric positions within a string span class="quote"
quoted text such as ...as it may from time to time be revised or amended. q
quoted character (refers to typically one, but occasionally more, specific characters). The character ç is common in French. span class="qchar"
quoted sample output (cf. HTML SAMP) The string artículo is subject to different representations samp
quoted code suc&#xE7;on code translate="no"
quoted keyboard input (cf. HTML KBD) a user typing çé on a traditional French-Canadian keyboard kbd
element name a user agent that looks for artículo elements span class="el" translate="no"
attribute name or value the section element code class="kw" translate="no"
function name The doit function returns interesting results. code class="kw" translate="no"
key word in a markup or programming language the IANA charset value code class="kw" translate="no"
variable name var
conformance related word based on rfc2119 All references to Unicode MUST refer to... span class="rfc2119"
acronyms & abbreviations More and more APIs are defined, abbr title="..."
Unicode name Use U+0338 COMBINING LONG SOLIDUS OVERLAY for that. span class="uname"
an URL that doesn't have a link on it https://github.com/w3c/repoName/ <span class="url">https://github.com/w3c/repoName/</span>

If you use b or i tags, use a class name with them, so that semantically different usages can be styled differently (esp. for documents with translations!).

Suggested styling for local.css

The following styles can be used as the base for the local.css file. They contain style rules for the approaches mentioned in this styleguide.

h2 {
	margin-top: 3em;
	margin-bottom: 0em;
	}
.head h2, #abstract h2, #sotd h2 {
	margin-top: 0;
	}
h3 {
	margin-top: 3em;
	}
h4  { 
	font-size: 100%; 
    font-weight: normal; 
    color: #005a9c; 
    margin-top: 2em;  
    }
.leadin {
	font-weight: bold;
	}

ins { 
	background-color: #99FF99; 
	text-decoration: none; 
	}
del { 
	display: inline; 
	color: silver; 
	}

figure { 
	margin-bottom: 2em; 
	text-align: center;
	}
figcaption {
	 text-align: center;
	margin: 0.5em 2em;
	font-style: italic;
	font-size: 90%;
	}
.figno:after {
	content: ':\00A0  ';
}

a.termref:link {
	color:#C60;
	text-decoration:none;
	border-bottom: 1px dotted #FC0; 
	}
a.termref:hover {
	color:#C60;
	text-decoration:none;
	border-bottom: 1px dotted #FC0; 
	}
a.termref:visited {
	color:#C60;
	text-decoration:none;
	border-bottom: 1px dotted #FC0; 
	}
a.termref:active {
	color:#C60;
	text-decoration:none;
	border-bottom: 1px dotted #FC0; 
	}

.qterm:before, .qchar:before { content: "'"; }
.qterm:after, .qchar:after { content: "'"; }
.quote:before { content: '"'; }
.quote:after { content: '"'; }
code { 
	color: #A52A2A; 
    font-family: Consolas, "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", Monaco, "Courier New", monospace; 
    font-size: 100%; 
    }
samp, kbd { 
	font-family: Consolas, "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", Monaco, "Courier New", monospace; 
    font-size: 100%; 
    }
.uname {
	text-transform: uppercase;
	font-size: 85%;
	letter-spacing:0.03em;
	}