Skip to content
nene edited this page Oct 25, 2012 · 5 revisions

To include guides use the --guides option to specify a path to a JSON file with the following structure:

    [
        {
            "title": "Ext JS 4 Guides",
            "items": [
                {
                    "name": "getting_started",
                    "url": "guides/getting_started",
                    "title": "Getting Started with Ext JS 4",
                    "description": "This introduction to Ext JS 4 explains how you can get started."
                },
                {
                    "name": "class_system",
                    "url": "guides/class_system",
                    "title": "The Class System",
                    "description": "Creating classes with the new class system in Ext JS 4.x."
                },
                {
                    "title": "Subgroup of guides",
                    "items": [
                        ...
                    ]
                }
                ...
            ]
        },
        ...
    ]

Each guide directory must contain a README.md file that contains the guide in Markdown format. For icon and other images, read further below.

Here's an example directory structure for the above guides.json:

somedir/
    guides.json
    guides/
        getting_started/
            README.md
            icon.png
            some-image.png
        class_system/
            README.md
            icon.png
            example.zip

Each guide must have a unique name. But the url field is not required - when it's not specified it will default to guides/<name>, e.g. in the case of the above example the url could be safely left out.

Formatting

Here's an example of how the guide should be formatted and structured:

# My Example guide

A guide about blah blah blah...

## First subsection

More text...

### A sub-subsection

- some
- bulleted
- list

## Second subsection

Even more text...

    @example
    function foo() {
        // live code example
    }

A guide must begin with a <h1> heading. That heading will be specially formatted when guide is shown. Normally that's the same as the "title" of the guide given in guides config JSON file.

All following headings must be <h2> or below. The <h2> headings will be used to generate a table of contents of the guide (it will only get created if there are at least two <h2> headings.

Style guide

The following is just recommendation, not a strict requirement.

Use the ###... style markup for headings instead of the underlined headings, as you need to use that style anyway if you want <h3> headings and beyond, plus it's harder for somebody who doesn't know Markdown syntax by hart, to tell the difference between <h1> and <h2> heading in the underlined markup. And just add the # chars at the beginning of line, don't repeat them at the end - keep it DRY.

Leave a blank line between the heading and text that follows - it will keep the markup more readable when one doesn't have editor with Markdown syntax highlighting.

Don't number your headings. The <h2> headings will get numbered in the generated table of contents anyway, so if you add your own numbers, the result will look silly and sloppy.

Don't write excessively long lines, relying on the line-wrapping of your editor. Instead wrap the lines manually like you do when writing comments in normal source code. This way it'll work much better with source control, making the diff much more useful and pleasant to read.

Icon

If guide directory contains an icon.png file, it will be used as an icon for the guide in guides index page (otherwise a default icon will be used).

Images

Guide-related images can be placed directly inside the guide directory and linked with and {@img} tag:

{@img some-image.png Alt text}

One can also use the Markdown image syntax to include images from any URL:

![Alt text](http://example.com/logo.png)

But {@img} tag should be preferred for local images as JSDuck will warn you about missing images referenced that way, while the Markdown image references aren't checked at all.

Links

To reference API classes and members use the {@link} tag as you would inside API docs:

See {@link Ext.Panel#title title} config for details.

To link other guides, use Markdown links in the form of:

Check out [Class System Guide](#!/guide/class_system) for additional reading.

You can link examples and videos in a similar way.

For all other links, also use the Markdown links. See the next section for linking to resources inside guide directory.

Other resources

You can include any other files inside the guide directory, and all of these will be copied over into JSDuck output directory.

But to link those resources, you need to use Markdown links with URL-s in form of guides/<guide-name>/<your-file>. For example:

[Download MVC example](guides/class_system/example.zip)