Theme:

Authoring Guide

Table of Contents

Testing

To work on the Handbook:

 > npm run start

This will start a live development server at http://localhost:8087. These pages will reload automatically on edits to page contents or CSS.

Encouraged Lesser-Known Syntax

Use {#anchor-name} to specify a custom page anchor name on a header:

  ### My Section Title about Things I Like {#things-i-like}

Special Syntax

Use [[Section Name]] to link to a section anywhere in the Handbook or Reference Pages by its title. The link text will always be the name of that section.

This accepts any combination of the following:

An error will be issued if a link is ambiguous.

Table of Contents: __toc__

Write __toc__ on a line by itself to insert the Table of Contents for a page. See the top of this page for an example.

Code Highlights: ^^^^^

You can use carets to highlight a specific part of a code sample:

function foo() {
         ^^^ Some text
}

This will render as:

function Some textfoo() {
}

Code QuickInfo Queries: ^?

You can use ^? to show the language service's quickinfo response at a location:

function foo() {
}
foo();
 ^?

This will render as:

function foo() {
}
foo();
 function foo(): voidTry

//cut comments

Sometimes a code sample should be able to refer to declarations that you don't want to display in a sample. Any code above a line containing only //cut will not be displayed, but the code will be highlighted and errored as if it were there.

Code Sample Options

@noErrors

Disables display of errors in a sample

@showEmit

Displays the emitted JavaScript for a file

Publishing

The site is published at https://microsoft.github.io/TypeScript-New-Handbook/outline/index.html via the master branch docs folder. To update this copy, run npm run publish, review the diff, and commit and push the result.

Walkthrough

The walkthrough is a series of pages which describe TypeScript, organized by concepts.

Each page of the walkthrough should:

The scope of each walkthrough page is not intended to be exhaustive. For example, the "compiler options" walkthrough page shouldn't list every option, just those that developers are most likely to need to know about.

Nearly every walkthrough page should start with a link to MDN Documentation for "background reading". We don't want to waste time documenting JavaScript features - our documentation should build on existing JS knowledge and resources.

Key Concepts!

Reading Level & Vocabulary

Most readers of this documentation will not be native English speakers. Keep the use of fancy words to a minumum; prefer short sentences and active-voice phrasing:

Voice (Walkthrough)

Consider using informal terms ("compatible with") when a technically-accurate description ("subtype of or assignable from") would interfere with understanding.

Use instructional, second-person narrative:

Use an approachable, but not overly chatty, level of formality:

Reference

Each reference article should provide a complete, spec-level explanation of a particular concept. A reader who completely understands all reference articles should be educated at the level of one of our own developers.

Voice (Reference)

In reference modules, do use technically-accurate descriptions.

Use third-person narrative: