--- title: Przewodnik po stylach dokumentacji MDN slug: MDN/Guidelines/Writing_style_guide tags: - Dokumentacja - Dokumenty MDN - Przewodnik - Przewodnik stylu MDN - Style w MDN translation_of: MDN/Guidelines/Writing_style_guide original_slug: MDN/Guidelines/Style_guide ---
W celu wyświetlenia dokumentacji w zorganizowany, znormalizowany i łatwy do odczytania sposób, przewodnik stylu Mozilla Developer Network opisuje, w jaki sposób tekst powinien być zorganizowany, zapisany, sformatowany i tak dalej. Są to wytyczne, a nie surowe zasady. Jesteśmy bardziej zainteresowani treścią niż formatowaniem, nie jesteś zobowiązany do uczenia się całego przewodnika po stylach MDN przed wniesieniem wkładu. Nie bądź jednak zdenerwowany lub zaskoczony, jeśli inny tłumacz zmodyfikuje w późniejszym czasie edytowany przez ciebie artykuł, aby dostosować się go, do głównych wytycznych stawianych dokumnetacji MDN.
Jeśli szukasz informacji jak dany typ strony powinien być ustrukturyzowany, zobacz poradnik dotyczący układu stron MDN
Aspekty językowe tego przewodnika dotyczą przede wszystkim dokumentacji w języku angielskim. Inne kraje mogą mieć (i mogą tworzyć) przewodniki po stylach we własnym języku. Tłumaczenia takie powinny być opublikowane jako podstrony, na lokalnych stronach MDN, dedykowanych dla danego języka przez zespół zajmujący się tłumaczeniami tzw. zespół lokalizacyjny.
Zapoznaj się ze standardami styli stosowanych do treści witryn innych niż MDN, zobacz Przewodnik po stylach One Mozilla.
Tytuły stron używane są w wynikach wyszukiwania, dzięki temu łatwiej jest znaleźć stronę w wynikach organicznych wyszukiwarek. Tytuły służą również do zachowania odpowiedniej struktury strony. Dlatego wraz z menu okruszkowym lub inaczej okruszkami(z ang. breadcrumbs) umieszczane są na górze strony, w celu zachowania odpowiedniej jej hierarchii. Tytuł, wyświetlany na górze w oknie przeglądarki, może różnić się od tzw. slug'a, który jest elemnetem adresu URL, następującym po "<locale>/docs/".
Tytuły stron i nagłówki sekcji(H1-H6) powinny być formatowane w taki sam sposób jak zdania. Wielka litera powinna być pisana na początku pierwszego słowa, również powinna wystąpić w nazwach własnych. Powinieneś unikać słów pisanych tzw. pismem wielbłądzim(które w anglojęzycznych krajach jest stosowane w tytułach):
Mamy wiele starszych stron, które zostały napisane przed ustanowieniem tej reguły stylu. Jeśli chcesz, możesz je aktualizować w razie potrzeby. Stopniowo do nich docieramy.
Page slugs should be kept short; when creating a new level of hierarchy, the new level's component in the slug should generally just be a word or two.
Page titles, on the other hand, may be as long as you like, within reason, and they should be descriptive.
When you need to add a number of articles about a topic or topic 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 a number of macros we've created.
For example, consider the JavaScript guide, which is structured like this:
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.
Use heading levels in decreasing order: {{HTMLElement("h2")}} then {{HTMLElement("h3")}} then {{HTMLElement("h4")}}, without skipping levels. H2 is the highest level allowed because H1 is reserved for the page title. If you need more than three or four levels of headers you should consider breaking up the article into several smaller articles with a landing page, linking them together using the {{TemplateLink("Next")}}, {{TemplateLink("Previous")}}, and {{TemplateLink("PreviousNext")}} macros.
The enter (or return) key on your keyboard starts a new paragraph. To insert a newline without a space, hold down the shift key while pressing enter.
Use the "Formatting Styles" drop-down list to apply predefined styles to selected content.
Unless specifically instructed to do so, do not use the HTML style
attribute to manually style content. If you can't do it using a predefined class, drop into Matrix and ask for help.
Use two spaces per tab in all code samples. Code should be indented cleanly, with open-brace ("{") characters on the same line as the statement that opens the block. For example:
if (condition) { /* handle the condition */ } else { /* handle the "else" case */ }
Long lines shouldn't be allowed to stretch off horizontally to the extent that they require horizontal scrolling to read. Instead, break at natural breaking points. Some examples follow:
if (class.CONDITION || class.OTHER_CONDITION || class.SOME_OTHER_CONDITION || class.YET_ANOTHER_CONDITION ) { /* something */ } var toolkitProfileService = Components.classes["@mozilla.org/toolkit/profile-service;1"] .createInstance(Components.interfaces.nsIToolkitProfileService);
Use the "Code" button (labeled with two angle brackets "<>") to apply inline code-style formatting to function names, variable names, and method names (this uses the {{HTMLElement("code")}} element). For example, "the frenchText()
function".
Method names should be followed by a pair of parentheses: doSomethingUseful()
. This helps to differentiate methods from other code terms.
Entire lines (or multiple lines) of code should be formatted using syntax highlighting rather than the {{HTMLElement("code")}} element. Click the "pre" button in the toolbar to create the preformatted content box in which you'll then write your code. Then, with the text entry cursor inside the code box, select the appropriate language from the language list button to the right of the "pre" button, as seen in the screenshot to the right. The following example shows text with JavaScript formatting:
for (var i = 0, j = 9; i <= 9; i++, j--) document.writeln("a[" + i + "][" + j + "]= " + a[i][j]);
If no appropriate transformation is available, use the pre
tag without specifying a language ("No Highlight" in the language menu).
x = 42;
There are various specific rules to follow when writing about HTML elements, in order to consistently describe the various components of elements, and to ensure that they're properly linked to detailed documentation.
<title>
).<input>
element is set to email
or tel
...Abbrev | Latin | English |
---|---|---|
cf. | confer | compare |
e.g. | exempli gratia | for example |
et al. | et alii | and others |
etc. | et cetera | and so forth, and so on |
i.e. | id est | that is, in other words |
N.B. | nota bene | note well |
P.S. | post scriptum | postscript |
Note: Always consider whether it's truly beneficial to use a Latin abbreviation. Some of these are used so rarely that many readers won't understand the meaning, and others are often confused with one another. And be sure that you use them correctly, if you choose to do so. For example, be careful not to confuse "e.g." with "i.e.", which is a common error.
Use full capitals and delete periods in all acronyms and abbreviations, including organizations such as "US" and "UN".
On the first mention of a term on a page, expand acronyms likely to be unfamiliar to users. When in doubt, expand it, or, better, link it to the article or glossary entry describing the technology.
For plurals of acronyms or abbreviations, add s. Don't use an apostrophe. Ever. Please.
Use standard English capitalization rules in body text, and capitalize "World Wide Web" and "Web".
Use contractions (e.g. "don't", "can't", "shouldn't") if you prefer. We're not that formal!
Use English-style plurals, not the Latin- or Greek-influenced forms.
Hyphenate compounds when the last letter of the prefix is a vowel and is the same as the first letter of the root.
It is a good idea to use gender-neutral language in any kind of writing where gender is irrelevant to the subject matter, to make the text as inclusive as possible. So for example, if you are talking about the actions of a specific man, usage of he/his would be fine, but if the subject is a person of either gender, he/his isn't really appropriate.
Let's take the following example:
A confirmation dialog appears, asking the user if he allows the web page to make use of his web cam.
A confirmation dialog appears, asking the user if she allows the web page to make use of her web cam.
Both versions in this case are gender-specific. This could be fixed by using gender-neutral pronouns:
A confirmation dialog appears, asking the user if they allow the web page to make use of their web cam.
Note: MDN allows the use of this very common syntax (which is controversial among usage authorities), in order to make up for the lack of a neutral gender in English. The use of the third-person plural as a neutral gender pronoun (that is, using "they," them", "their," and "theirs") is an accepted practice, commonly known as "singular 'they.'"
You can use both genders:
A confirmation dialog appears, asking the user if he or she allows the web page to make use of his/her web cam.
making the users plural:
A confirmation dialog appears, asking the users if they allow the web page to make use of their web cams.
The best solution, of course, is to rewrite and eliminate the pronouns completely:
A confirmation dialog appears, requesting the user's permission for web cam access.
A confirmation dialog box appears, which asks the user for permission to use the web cam.
The last way of dealing with the problem is arguably better, as it is not only grammatically more correct but removes some of the complexity associated with dealing with genders across different languages that may have wildly varying gender rules. This can make translation easier, both for readers reading English, then translating it into their own language as they read, and for localizers translating articles into their own language.
For dates (not including dates in code samples) use the format "January 1, 1990".
Alternately, you can use the YYYY/MM/DD format.
For decades, use the format "1990s". Don't use an apostrophe.
For plurals of numerals add "s". Don't use an apostrophe.
In running text, use commas only in five-digit and larger numbers.
Use the serial comma. The serial (also known as "Oxford") comma is the comma that appears before the conjunction in a series of three or more items.
Note: This is in contrast to the One Mozilla style guide, which specifies that the serial comma is not to be used. MDN is an exception to this rule.
For words with variant spellings, always use the first entry at Answers.com. Do not use variant spellings.
It's important to be clear on the difference between the terms obsolete and deprecated.
Use "elements" to refer to HTML and XML elements, rather than "tags". In addition, they should almost always be wrapped in "<>", and should be in the {{HTMLElement("code")}} style. Also, at least the first time you reference a given element in a section should use the {{TemplateLink("HTMLElement")}} macro, to create a link to the documentation for the element (unless you're writing within that element's reference document page).
In task sequences, describe user interface actions using the imperative mood. Identify the user interface element by its label and type.
While the active voice is generally preferred, the passive voice is also acceptable, given the informal feel of our content. Try to be consistent, though.
To automatically create a link to a Bugzilla bug, use this template:
\{{Bug(322603)}}
This results in:
{{Bug(322603)}}
For WebKit bugs, you can use this template:
\{{Webkitbug("322603")}}
This results in:
{{Webkitbug("322603")}}
Tags provide meta information about a page and/or indicate that a page has specific improvements needed to its content. Every page in the wiki should have tags. You can find details on tagging in our How to properly tag pages guide.
The tagging interface lives at the bottom of a page while you're in edit mode, and looks something like this:
To add a tag, click in the edit box at the end of the tag list and type the tag name you wish to add. Tags will autocomplete as you type. Press enter (or return) to submit the new tag. Each article may have as many tags as needed. For example, an article about using JavaScript in AJAX programming might have both "JavaScript" and "AJAX" as tags.
To remove a tag, simply click the little "X" icon in the tag.
In addition to using tags to track information about the documentation's quality and content, we also use them to mark articles as needing specific types of work.
Use the following tags for pages that are not current:
The SEO summary is a very short summary of the page. It will be reported as a summary of the article to robots crawling the site, and will then appear in search results for the page. It is also used by macros that automate the construction of landing pages inside MDN itself.
By default, the first pagragraph of the page is used as the SEO summary. However you can override this behavior by marking a section with the "SEO summary" style in the WYSIWYG editor.
Landing pages are pages at the root of a topic area of the site, such as the main CSS or HTML pages. They have a standard format that consists of three areas:
The link list section of an MDN landing page consists of two columns. These are created using the following HTML:
<div class="row topicpage-table"> <div class="section"> ... left column contents ... </div> <div class="section"> ... right column contents ... </div> </div>
The left-hand column should be a list of articles, with an <h2>
header at the top of the left column explaining that it's a list of articles about the topic (for example "Documentation and tutorials about foo"); this header should use the CSS class "Documentation". Below that is a <dl>
list of articles, with each article's link in a <dt>
block and a brief one-or-two sentence summary of the article in the corresponding <dd>
block.
The right-hand column should contain one or more of the following sections, in order:
<<<finish this once we finalize the landing page standards>>>
It's sometimes helpful to provide an image in an article you create or modify, especially if the article is very technical. To include an image:
If you have questions about usage and style not covered here, we recommend referring to the Economist style guide or, failing that, the Chicago Manual of Style.
For questions of spelling, please refer to Answers.com. The spell-checker for this site uses American English. Please do not use variant spellings (e.g., use honor rather than honour).
We will be expanding the guide over time, so if you have specific questions that aren't covered in this document, please send them to the MDC mailing list or project lead so we know what should be added.
If you're interested in improving your writing and editing skills, you may find the following resources to be helpful.