docs.rodeo

MDN Web Docs mirror

Writing style guide

This writing style guide describes how content should be written, organized, spelled, and formatted on MDN Web Docs.

These guidelines are for ensuring language and style consistency across the website. That said, we are more interested in content rather than its formatting, so don’t feel obligated to learn the entire writing style guide before contributing. Do not be upset or surprised, however, if another contributor later edits your work to conform to this guide. The reviewers might also point you to this style guide when you submit a content pull request.

[!NOTE] The language aspects of this guide apply primarily to English-language documentation. Other languages may have (and are welcome to create) their own style guides. These should be published as subpages of the respective localization team’s page. However, this guide should still be consulted for formatting and organizing content.

After listing the general writing guidelines, this guide describes the recommended writing style for MDN Web Docs and then how to format different components on a page, such as lists and titles.

General writing guidelines

The goal is to write pages that include all the information that readers may need for understanding the topic at hand.

The following subsections provide the recommendations to achieve this:

Consider your target audience

Keep the target audience for the content you are writing in mind. For example, a page on advanced network techniques likely doesn’t need to go into as much detail about basic networking concepts as the typical page on networking. Keep in mind that these are guidelines. Some of these tips may not apply in every case.

Consider the three Cs of writing

The three Cs of good writing are writing clearly, concisely, and consistently.

Include relevant examples

In general, add examples or real-life scenarios to better explain the content you are writing. This helps readers to understand conceptual and procedural information in a more tangible and practical way.

You should use examples to clarify what every parameter is used for and to clarify any edge cases that may exist. You can also use examples to demonstrate solutions for common tasks and solutions to problems that may arise.

Provide a descriptive introduction

Make sure that the opening paragraph(s) before the first heading adequately summarizes the information that the page will cover and perhaps what readers will be able to achieve after going through the content. This way a reader can determine quickly whether the page is relevant to their concerns and desired learning outputs.

In a guide or tutorial, the introductory paragraph(s) should inform the reader about the topics that will be covered as well as the prerequisite knowledge the reader is expected to have, if any. The opening paragraph should mention the technologies and/or APIs that are being documented or discussed, with links to the related information, and it should offer hints to situations in which the article’s contents might be useful.

Use inclusive language

MDN has a wide and diverse audience. We strongly encourage keeping text as inclusive as possible. Here are some alternatives to common terms used in documentation:

It is best to use gender-neutral language in any writing where gender is irrelevant to the subject matter. For example, if you are talking about the actions of a specific man, using “he”/“his” is fine; but if the subject is a person of either gender, “he”/“his” isn’t appropriate.

Let’s look at the following examples:

Both versions are gender-specific. To fix this, use gender-neutral pronouns like so:

[!NOTE] MDN Web Docs allows the use of third-person plural, commonly known as “singular ‘they’.”. The gender-neutral pronouns include “they,” “them”, “their,” and “theirs”.

Another option is to make the users plural, like so:

The best solution, of course, is to rewrite and eliminate the pronouns:

This last example of dealing with the problem is arguably better. Not only is it grammatically more correct, but removes some of the complexity associated with dealing with genders across different languages that may have wildly different gender rules. This solution can make translation easier for both readers and translators.

Write with SEO in mind

While the primary goal of any writing on MDN Web Docs should always be to explain and inform about open web technology so developers can quickly learn to do what they want or to find the little details they need to know in order to perfect their code, it’s important that they be able to find the material we write. We can achieve this by keeping Search Engine Optimization ({{Glossary("SEO")}} ) in mind while writing.

This section covers the standard practices, recommendations, and requirements for content to help ensure that search engines can easily categorize and index our material to ensure that readers can easily find what they need. The SEO guidelines include ensuring that each page that writers and editors work on is reasonably well-designed, written, and marked up to give search engines the context and clues they need to properly index the articles.

The following checklist is good to keep in mind while writing and reviewing content to help ensure that the page and its neighbors will be indexed properly by search engines:

Writing style

Other than writing grammatically correct sentences in English, we recommend you follow these guidelines to keep content consistent across MDN Web Docs.

Abbreviations and acronyms

An abbreviation is a shortened version of a longer word, while an acronym is a new word created using the first letter of each word from a phrase. This section describes guidelines for abbreviations and acronyms.

Capitalization

Use standard English capitalization rules in body text, and capitalize “World Wide Web.” It is acceptable to use lower case for “web” (used alone or as a modifier) and “internet”.

[!NOTE] This guideline is a change from a previous version of this guide, so you may find many instances of “Web” and “Internet” on MDN. Feel free to change these as you are making other changes, but editing an article just to change capitalization is not necessary.

Keyboard keys should use sentence-style capitalization, not all-caps capitalization. For example, “Enter” not “ENTER”. The only exception is that you can use “ESC” to abbreviate the “Escape” key.

Certain words should always be capitalized, such as trademarks that include capital letters or words that derive from the name of a person (unless the word is being used within code and the code syntax requires lower-casing). Some examples include:

Contractions

Our writing style tends to be casual, so you should feel free to use contractions (e.g., “don’t”, “can’t”, “shouldn’t”), if you prefer.

Numbers and numerals

Pluralization

Use English-style plurals, not the Latin- or Greek-influenced forms.

Apostrophes and quotation marks

Do not use “curly” quotes and quotation marks. On MDN Web Docs, we only use straight quotes and apostrophes. This is because we need to choose one or the other for consistency. If curly quotes or apostrophes make their way into code snippets, even inline ones, readers may copy and paste them, expecting them to function (which they will not).

Commas

The list below describes some of the common situations where we need to be aware of the comma usage rules:

Hyphens

Compound words should be hyphenated only when the last letter of the prefix is a vowel and is the same as the first letter of the root.

Spelling

Use American-English spelling.

In general, use the first entry at Dictionary.com, unless that entry is listed as a variant spelling or as being primarily used in a non-American form of English. For example, if you look up “behaviour” (with an additional u added to the American standard form), you find the phrase “Chiefly British” followed by a link to the American standard form, “behavior”. Do not use variant spelling.

We have cSpell installed to catch spelling errors. It runs every week and generates a report of spelling errors in the repository. You can also run it locally via the following command:

npx cspell --no-progress --gitignore --config .vscode/cspell.json "**/*.md"

In the repository, we maintain several word lists, located at .vscode/dictionaries, that contain sanctioned words not in the default dictionaries. You can add more words to these lists if they are valid but reported by the spell checker. Read .vscode/cspell.json to understand what each dictionary contains and the details of our spell-checking configuration.

Terminology

These are our recommendations for using certain technical terms:

Voice

While the active voice is preferred, the passive voice is also acceptable, given the informal feel of our content. Try to be consistent, though.

Page components

This section lists the guidelines to follow for different parts of each page, such as headings, notes, links, and examples.

Code examples

A page on MDN Web Docs can contain more than one code example. The following list presents some recommended practices when writing a code example for MDN Web Docs:

To learn about how to style or format code examples for MDN Web Docs, see Guidelines for styling code examples.

Cross-references (linking)

When referencing another page or the section of a page on MDN by its title, follow sentence casing in the link text (match the page or section title). Use sentence casing in the link text even if it is different from the linked page title or section title (it might be that the case used in the page or section title is incorrect). Don’t use quotation marks around the link text. To refer to a page on MDN by its title, use the following style:

Follow similar style when linking to a section on a page, as shown below:

If the section you’re linking to is on the same page, you can hint at the location of the section using the words “above” or “below”.

You can link part of a sentence to an article or the section of an article. Be mindful to use descriptive phrases as link texts to provide enough context for the page being linked.

On MDN, another way to link to a reference page is by using a macro. These macros are described on the Commonly-used macros page. For example, to link to the reference page of an HTML element, use the HTMLElement macro, and to link to the reference page of a CSS property, use the CSSxRef macro.

We follow similar cross-referencing guidelines in the See also sections at the end of reference pages, glossary pages, and guides.

External links are allowed on MDN Web Docs in specific situations. Use the guidelines described in this section to decide whether or not it is okay to include an external link on MDN Web Docs. Your pull request to add an external link will be rejected if it does not meet the guidelines described here.

If you are considering adding an external link to MDN Learn web development content, please also read Learn web development writing guidelines > External links and embeds.

In general, if you’re considering adding an external link, you need to ensure that there is minimal risk of the following:

[!NOTE] Before adding an external link, consider cross-referencing content within MDN Web Docs. Internal links are easier to maintain and make the entirety of MDN Web Docs more valuable to readers.

Shortened URLs (shortlinks)

A URL shortener (such as TinyURL or Bitly) can be great for shortening long links into small, easier-to-remember URLs (also known as “shortlinks”). However, they also obfuscate the destination of the URL. Additionally, with certain shorteners, the destination can be changed after their creation, a feature that could be utilized for malicious purposes.

Do not use links created via third-party (user-generatable) URL shorteners. For example, if https://myshort.link/foobar is a short URL generated by a random user and redirects to https://example.com/somelongURL/details/show?page_id=foobar, use the longer example.com URL.

On the other hand, first-party shorteners that are maintained by the organizations that also maintain the destination URLs are encouraged. https://bugzil.la is owned and operated by Mozilla and is a URL shortener that redirects to https://bugzilla.mozilla.org/, which is also a Mozilla-owned domain. In this case, use the shorter URL. For example, use https://bugzil.la/1682349 instead of https://bugzilla.mozilla.org/show_bug.cgi?id=1682349.

Heading levels

When a new paragraph starts a new section, a header should be added. Use these markdown heading levels in decreasing order without skipping levels: ##, then ###, and then ####; these translate to the HTML heading tags <h2>, <h3>, and <h4> tags, respectively.

## is the highest level allowed because # is reserved for the page title. We recommend to not add more than three levels of headers. If you feel the need for adding the fourth header level, consider breaking up the article into several smaller articles with a landing page. Alternatively, see if you can present the information in bulleted points to avoid adding level four header.

Keep the following dos and don’ts in mind while creating headings for subsections:

Images and other media

If you include images or other media on a page, follow these guidelines:

Lists

Lists should be formatted and structured consistently across all pages. Individual list items should be written with suitable punctuation, regardless of the list format. However, depending on the type of list you are creating, you will want to adjust your writing as described in the sections below. In both cases, include a lead-in sentence that describes the information in the list.

See also section

Most of the guides, reference pages, and even glossary pages on MDN Web Docs contain a See also section at the end of the article. This section contains cross-references to related topics within MDN and sometimes links to related external articles. For example, this is the See also section for the @layer page.

In general, present the links in a See also section in a bulleted list format with each item in the list as a phrase. In the Learn web development section on MDN, however, the See also section follows the definition list format.

To maintain consistency across MDN Web Docs, keep the following guidelines in mind while adding or updating a See also section.

Descriptive text

Subpages

When you need to add some articles about a topic or subject area, you will typically do so by creating a landing page, then adding subpages for each of the individual articles. The landing page should open with a paragraph or two describing the topic or technology, then provide a list of the subpages with descriptions of each page. You can automate the insertion of pages into the list using some macros we’ve created.

For example, consider the JavaScript guide, which is structured as follows:

Try to avoid putting your article at the top of the hierarchy, which slows the site down and makes search and site navigation less effective.

Slugs

The page title, which is displayed at the top of the page, can be different from the page “slug”, which is the portion of the page’s URL following <locale>/docs/. Keep the following guidelines in mind when defining a slug:

Titles

Page titles are used in search results and are also used to structure the page hierarchy in the breadcrumb list at the top of the page. A page title can be different from the page “slug”, as explained in the Slugs section.

Keep the following guidelines in mind when writing titles:

See also

Further reading

Other style guides

If you have questions about usage and style not covered here, we recommend referring to the Microsoft Writing Style Guide or the Chicago Manual of Style.

Language, grammar, and spelling

If you’re interested in improving your writing and editing skills, you may find the following resources to be helpful.

In this article

View on MDN