Skip to content

Commit 5a62edd

Browse files
authored
Merge pull request #116 from bravo-kernel/quickstart-guide
Full rewrite of the Quickstart Guide
2 parents f625b71 + 51192e5 commit 5a62edd

File tree

1 file changed

+74
-35
lines changed

1 file changed

+74
-35
lines changed

tests/dummy/app/pods/docs/quickstart/template.md

Lines changed: 74 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,38 @@
11
# Quickstart
22

3-
This quickstart guide will get you going with a docs site for your brand new addon.
3+
This quickstart guide will get you started with a docs site for your brand new
4+
addon. After completion you will have a docs homepage, a docs subpage named
5+
`usage`, an automatically generated API reference and a nice looking
6+
marketing/demo page you can use to promote your addon.
47

5-
1. **Install the addon.**
8+
1. **Install Addon Docs.**
69

710
```
811
ember install ember-cli-addon-docs
912
```
1013

11-
2. **Add the required routes.** Open `tests/dummy/app/router.js` and add the following route definitions:
14+
2. **Add the docs routes.** Open `tests/dummy/app/router.js` and add the
15+
following route definitions to your main route.
1216

1317
{{#docs-snippet name='quickstart-router.js' title='tests/dummy/app/router.js'}}
14-
this.route('docs', function() {
15-
this.route('api', function() {
16-
this.route('item', { path: '/*path' });
18+
this.route('docs', function() { // docs homepage (required)
19+
this.route('usage'); // docs subpage
20+
this.route('api', function() { // autogenerated API homepage (required)
21+
this.route('item', { path: '/*path' }); // autogenerated API subpages (required)
1722
});
1823
});
1924
{{/docs-snippet}}
2025

21-
3. **Create your app skeleton.** You can add the global keyboard shortcuts component to enable keyboard navigation around your docs site (use `?` to show the help window). Here's our application template:
26+
3. **Create your docs skeleton.** Create a new template for the `docs` route
27+
and make sure it contains the `DocsViewer` component and navigation items for
28+
all docs pages in your site.
2229

23-
{{docs-snippet name="docs-demo-application-template.hbs" title="tests/dummy/app/templates/application.hbs"}}
24-
25-
4. **Create your docs skeleton.** Create a template for the `docs` route and add the DocsViewer component.
26-
27-
{{#docs-snippet name='quickstart-skeleton.hbs' title='tests/dummy/app/pods/docs/template.hbs'}}
30+
{{#docs-snippet name='quickstart-skeleton.hbs' title='tests/dummy/app/templates/docs.hbs'}}
2831
{{#docs-viewer as |viewer|}}
2932

3033
{{#viewer.nav as |nav|}}
31-
{{nav.item 'Overview' 'docs.index'}}
34+
{{nav.item 'Introduction' 'docs.index'}}
35+
{{nav.item 'Usage' 'docs.usage'}}
3236
{{/viewer.nav}}
3337

3438
{{#viewer.main}}
@@ -42,15 +46,48 @@ This quickstart guide will get you going with a docs site for your brand new add
4246
{{/docs-viewer}}
4347
{{/docs-snippet}}
4448

45-
5. **Fill out the index of your docs page.** We called it Overview but you can call it whatever you want. Since Addon Docs supports markdown templates out of the box, we can make this a Markdown file.
49+
4. **Create your Markdown templates.** Markdown templates contain the actual
50+
documentation for your addon and live in the folder
51+
`tests/dummy/app/templates/docs`. Since Addon Docs supports Markdown out
52+
of the box we will create two `.md` files (one for your docs `index` and one
53+
for the `usage` page).
4654

47-
{{#docs-snippet name='quickstart-markdown.md' title='tests/dummy/app/templates/docs/index.md' language='markdown'}}
48-
# Overview
55+
{{#docs-snippet name='quickstart-markdown-index.md' title='tests/dummy/app/templates/docs/index.md' language='markdown'}}
56+
# Index
4957

5058
This is my new addon, and it rocks!
5159
{{/docs-snippet}}
5260

53-
6. **Add a 404 route.** Add a route to the end of your router and create an associated template.
61+
{{#docs-snippet name='quickstart-markdown-subpage.md' title='tests/dummy/app/templates/docs/usage.md' language='markdown'}}
62+
# Usage
63+
64+
So easy to use, sweet!
65+
{{/docs-snippet}}
66+
67+
5. **Create your marketing homepage**. Addon Docs comes with a set of
68+
components that take out all the hard work normally required for creating
69+
good looking marketing/demo pages. Creating a template with the following
70+
components will instantly give your main page a navbar, a nice hero
71+
and a snippet-ready demo container.
72+
73+
{{#docs-snippet name='quickstart-marketing-index.hbs' title='tests/dummy/app/templates/index.hbs'}}
74+
{{docs-navbar}}
75+
76+
{{docs-hero
77+
logo='ember'
78+
slimHeading='My'
79+
strongHeading='Addon'
80+
byline='My addon demo/marketing page.'}}
81+
82+
{{#docs-demo as |demo|}}
83+
{{#demo.example name='my-demo.hbs'}}
84+
<p>Make sure to read up on the DocsDemo component before building out this page.</p>
85+
{{/demo.example}}
86+
{{/docs-demo}}
87+
{{/docs-snippet}}
88+
89+
6. **Add a 404 route.** Add the following route to the end of your router and
90+
create the associated template.
5491

5592
{{#docs-snippet name='quickstart-404.js' title='tests/dummy/app/router.js'}}
5693
this.route('not-found', { path: '/*path' });
@@ -63,28 +100,30 @@ This quickstart guide will get you going with a docs site for your brand new add
63100
</div>
64101
{{/docs-snippet}}
65102

66-
8. **Add more docs pages.** It's up to you how to structure your docs - use the Snippet, Viewer and Demo components to help you write your documentation. Let's add another page to ours: we'll add the route, link to our docs viewer, and the actual template.
103+
7. **Launch your docs site**. Run `ember serve` and browse to
104+
`localhost:4200/docs` to enjoy your brand new documentation website.
67105

68-
{{#docs-snippet name='quickstart-more-docs.js' title='tests/dummy/app/router.js'}}
69-
this.route('docs', function() {
70-
this.route('installation');
71-
});
72-
{{/docs-snippet}}
106+
8. **Create more pages.** To add more doc pages simply follow the same steps as
107+
used for the `Usage page in above examples`:
73108

74-
{{#docs-snippet name='quickstart-more-nav.hbs' title='tests/dummy/app/templates/docs.hbs'}}
75-
{{#viewer.nav as |nav|}}
76-
{{nav.item 'Installation' 'docs.installation'}}
77-
{{/viewer.nav}}
78-
{{/docs-snippet}}
109+
- create a docs subroute
110+
- add a corresponding navigation item to the `docs` template
111+
- create a corresponding Markdown template
79112

80-
{{#docs-snippet name='quickstart-installation-readme.md' title='tests/dummy/app/templates/docs/installation.md'}}
81-
# Installation
113+
## Optional
82114

83-
To install My Addon, run...
84-
{{/docs-snippet}}
115+
1. **Keyboard navigation.** You may want to enable keyboard navigation for your
116+
docs site by adding the `DocsKeyboardShortcuts` component to your dummy
117+
application template. Once enabled you can use `?` to show the navigation help
118+
windows.
119+
120+
{{docs-snippet name="docs-demo-application-template.hbs" title="tests/dummy/app/templates/application.hbs"}}
85121

86-
8. **Round out your site.**
122+
2. **Add a favicon.** You may want to place a favicon in the
123+
`tests/dummy/public` folder. We recommend using using
124+
[Ember CLI Favicon](https://github.com/davewasmer/ember-cli-favicon).
87125

88-
* **Add a favicon to your dummy app.** We recommend using [Ember CLI Favicon](https://github.com/davewasmer/ember-cli-favicon).
126+
3. **Better scrolling.** You may want to install
127+
[Ember Router Scroll](https://github.com/dollarshaveclub/ember-router-scroll)
128+
to enable "scroll to top with preserved browser history scroll position".
89129

90-
* **Install [Ember Router Scroll](https://github.com/dollarshaveclub/ember-router-scroll).**

0 commit comments

Comments
 (0)