Skip to content

Commit 9579f35

Browse files
committed
Updating docs for 0.5.0
1 parent ba5708f commit 9579f35

File tree

9 files changed

+69
-49
lines changed

9 files changed

+69
-49
lines changed

assets/js/modules/codeSource.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ define([
3636
var RES_HIDE_CODE = 'Hide';
3737
var RES_SHOW_CODE = 'Show';
3838
var RES_CODE = 'code';
39-
var RES_TOGGLER_SHOW_CODE = 'Show source';
39+
var RES_TOGGLER_SHOW_CODE = 'Show source code';
4040

4141
var urlConfig = 'sc';
4242

assets/templates/header.inc.html

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<li class="source_header_nav_i"><a class="source_a_l" href="#777">Link</a></li>
1818
</ul>
1919
</nav>
20+
2021
<a class="js-hook source_login"></a>
2122
</div>
2223
</div>

docs/auth/readme.md

+9-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ After that, auth feature is able to use.
2121

2222
### Client-side auth control
2323

24-
Github auth module includes client-side controll. It should be included into your `header.inc.html` (if you have the overridden one). Here is the example:
24+
GitHub login module should be embedded into your `header.inc.html` or any other place you want.
25+
26+
Here is the example:
2527

2628
```html
2729
<!-- header.inc.html content-->
@@ -33,13 +35,15 @@ Auth uses `js-hook` and `source_login` classes for targeting. This hook is defin
3335

3436
## Auth configuration
3537

36-
Auth configuration is availible from your instance options, as it was mentioned above. Here is the full options list:
38+
Auth configuration is available from your instance [options](/docs/base/#configuration), as it was mentioned above. Here's few of available options:
3739

3840
```js
3941
// localStorage key for client-side user object
4042
'storageKey': 'sourcejsUser',
43+
4144
// avatar stub URL
4245
'defaultAvatarURL': '/source/assets/i/unknown.gif',
46+
4347
// set of client-side control classes
4448
'classes': {
4549
'controlsWrapper': 'source_login',
@@ -48,13 +52,16 @@ Auth configuration is availible from your instance options, as it was mentioned
4852
'anonymous': 'anonymous',
4953
'hook': 'js-hook'
5054
},
55+
5156
// login/logout button labels
5257
'labels': {
5358
'login': 'Login',
5459
'logout': 'Logout'
5560
}
5661
```
5762

63+
View the full list in `/assets/js/modules/auth.js` file.
64+
5865
## Auth modules usage
5966

6067
Both server-side and client-side auth parts are able to use from other modules.

docs/base/readme.md

+18-24
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ $ cd sourcejs-folder
1919
$ yo sourcejs
2020
```
2121

22-
If you're running Windows, and have some issues with [jsdom](https://github.com/tmpvar/jsdom) dependencies compilation, check this [topic](https://github.com/sourcejs/Source/issues/23).
22+
If you're running Windows and have some issues with [jsdom](https://github.com/tmpvar/jsdom) dependencies compilation, check this [topic](https://github.com/sourcejs/Source/issues/23).
2323

2424
### Run Commands
2525

@@ -31,9 +31,9 @@ $ node app
3131

3232
For first dev build Grunt will run automatically right after Yeoman init, here's a list of [all Grunt tasks available](/docs/grunt).
3333

34-
## First spec
34+
## Creating First Spec
3535

36-
Specs are the main content files in SourceJS engine, in them you define all your description of chosen components and it's code examples. Originally we use `*.src` file templates, but you're free to configure your own with [Jade](https://github.com/sourcejs/sourcejs-jade) for example.
36+
Specs are the main content files in SourceJS engine, in them you define all your description of chosen components and it's code examples. Originally we use `*.src` and `*.md` file templates, but you're free to configure your own technologies with plugins, like [Jade](https://github.com/sourcejs/sourcejs-jade) for example.
3737

3838
<div class="source_note">
3939
After initialization, you get `sourcejs/user` folder, which is the place for all your custom content. All new Specs and configuration of main engine must be done there.
@@ -47,32 +47,24 @@ The starting template for new **Spec** pages can be found in [/docs/starting](/d
4747

4848
### Server-side Templating Engines
4949

50-
As we mentioned before, it's easy to use other server-side/compiled templating engines like Jade, you only need to create a simple SourceJS middleware ([example](https://github.com/sourcejs/sourcejs-jade)) or process your sources with Grunt/Gulp. `*.src` files, that we use by default are processed with [EJS](https://github.com/tj/ejs), so you're free to use custom EJS features in any spec page - like includes or even plain JavaScript.
50+
As we mentioned before, it's easy to use other server-side/compiled templating engines like Jade, you only need to create a simple SourceJS middleware ([example](https://github.com/sourcejs/sourcejs-jade)) or process your sources with Grunt/Gulp.
51+
52+
`*.src` files, that we use by default are processed with [EJS](https://github.com/tj/ejs), so you're free to use custom EJS features in any spec page - like includes or even plain JavaScript.
5153

5254
We treat Spec files as an interface, you can construct your Spec page in any ways, following only few simple rules - each Spec must have `info.json` file aside, with meta information for the Engine and output spec page must have SourceJS compliant markup. Special markup contains only few vital classes like `.source_section`, `.source_example` and the rest is plain, semantic HTML.
5355

5456
### Client-side Templating Eninges
5557

56-
For client-side templating you don't need any magic, just link Mustache or any other technology to your page and use it whenever you want. Remember, SourceJS Specs are a simple static pages, that are then enchanted with client-side scripts and internal APIs.
57-
58-
After 0.4 release we will put quite a lot of effort, creating example with popular technologies for fast scaffolding your SourceJS library.
58+
For client-side templating you don't need any magic, just link Mustache or any other JS library to your page and use it whenever you want. Remember, SourceJS Specs are a simple static pages, that are then enchanted with client-side scripts and internal APIs.
5959

6060
## Examples
6161

62-
Main project website [Sourcejs.com](http://sourcejs.com) is based on SourceJS engine, as well as all documentation that you're surfing right now. To see more complex example of Spec page, check out [this section](/docs/spec/).
62+
Main project website [Sourcejs.com](http://sourcejs.com) is based on SourceJS engine, as well as all documentation that you're surfing right now. To see more complex example of Spec page, check out [this spec](/docs/spec/).
6363

6464
You can inspect [Sourcejs.com source code](https://github.com/sourcejs/Sourcejs.com), that demonstrates basic `source/user` folder contents.
6565

6666
More examples and screencasts coming soon, but for now, you can check this [SourceJS video presentation](https://www.youtube.com/watch?v=ukFeZnJjrLs) (RU with EN subtitles).
6767

68-
## File Structure
69-
70-
Engine architecture is based on **two enviroments:**
71-
72-
73-
* **assets** - JavaScript front-end
74-
* **core** - NodeJS back-end
75-
7668
## Configuration
7769

7870
All default options for `assets` (front-end) and `core` (back-end) are located in `sourcejs/options.js`. To overwrite basic options, user your own `sourcejs/user/options.js` file, from your SourceJS instance home directory.
@@ -120,14 +112,16 @@ Plugins could have `core` and `assets` parts to improve both back-end and front-
120112

121113
Here's few official plugins:
122114

123-
* <a class="source_a_hl" href="https://github.com/sourcejs/sourcejs-spec-status">sourcejs-spec-status</a>
124-
* <a class="source_a_hl" href="https://github.com/sourcejs/sourcejs-crowd-voice">sourcejs-crowd-voice</a>
125-
* <a class="source_a_hl" href="https://github.com/sourcejs/sourcejs-jade">sourcejs-jade</a>
126-
* <a class="source_a_hl" href="https://github.com/sourcejs/sourcejs-comments">sourcejs-comments</a>
127-
* <a class="source_a_hl" href="https://github.com/sourcejs/sourcejs-specs-linting">sourcejs-specs-linting</a>
128-
* <a class="source_a_hl" href="https://github.com/sourcejs/sourcejs-spec-dependencies">sourcejs-spec-dependencies</a>
129-
* <a class="source_a_hl" href="https://github.com/sourcejs/sourcejs-smiles">sourcejs-smiles</a>
115+
* [sourcejs-spec-status](https://github.com/sourcejs/sourcejs-spec-status)
116+
* [sourcejs-crowd-voice](https://github.com/sourcejs/sourcejs-crowd-voice)
117+
* [sourcejs-jade](https://github.com/sourcejs/sourcejs-jade)
118+
* [sourcejs-comments](https://github.com/sourcejs/sourcejs-comments)
119+
* [sourcejs-specs-linting](https://github.com/sourcejs/sourcejs-specs-linting)
120+
* [sourcejs-spec-dependencies](https://github.com/sourcejs/sourcejs-spec-dependencies)
121+
* [sourcejs-smiles](https://github.com/sourcejs/sourcejs-smiles)
122+
123+
Follow [this guide](/docs/api/plugins) to jump into own SourceJS plugin development.
130124

131125
## Contact us
132126

133-
Leave your questions and feedback as [issues](https://github.com/sourcejs/Source/issues) on Github.
127+
Leave your questions and feedback as [issues](https://github.com/sourcejs/Source/issues) on GitHub.

docs/data-nav/readme.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
# Autogenerated Navigation
22

3-
Navigation generation in Source in fully automated, and allows us to call any list of specs using simple HTML hooks.
3+
Navigation generation in SourceJS in automated, and allows us to call any list of specs using simple HTML hooks.
44

55
## Embedding
66

7-
Common scheme of embedding looks like this:
7+
To embed auto-generated navigation to your page, just add this code snippet:
88

99
```html
1010
&lt;div class="source_catalog" data-nav="/docs">&lt;/div>
1111
```
1212

13-
Required attribute `data-nav` names the catalogue to be displayed. Inserting mentioned code in any Source page a navigation like this will be generated:
13+
`data-nav` attribute defines the catalogue to be displayed. Inserting mentioned code in any Source page a navigation like this will be generated:
1414

1515
<div class="source_catalog" data-nav="/docs"></div>
1616

1717

18-
### Absolute pathя
18+
### Absolute path
1919

2020
We recommend using absolute paths, as they are more stable and predictable.
2121

@@ -29,7 +29,7 @@ Renders like this:
2929

3030
<div class="source_catalog" data-nav="/docs/api"></div>
3131

32-
Also, you could leave a direct path to any Spec:
32+
Also, you could leave a direct path to any Spec, which may have nested items inside:
3333

3434
```html
3535
&lt;div class="source_catalog" data-nav="/docs/clarify">&lt;/div>
@@ -84,7 +84,7 @@ As we can define different tags for specs in `info.json` files (more in [docs](/
8484
```
8585

8686
<div class="source_catalog" data-nav="/docs" data-tag="templates">
87-
<h2 class="source_catalog_title">Specs with `templates` tag</h2>
87+
<h2 class="source_catalog_title">Specs with "templates" tag</h2>
8888
</div>
8989

9090
To call all specs without a tags, you can filter by `"without-tag"` string.

docs/markdown/readme.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,21 @@ In case if Spec folder contains `index.src` and `index.md`, first one will have
2323
|---|---|
2424
| Td | value |
2525

26+
```html
27+
&#96;``example
28+
code example
29+
&#96;``
30+
```
2631

2732
```example
28-
Mark code with `example` keywork to define `.source_example` with your renderen component view.
33+
Mark code with `example` keyword to define `.source_example` with your rendered component view.
2934
<br><br>
3035
<a class="btn btn-primary" href="#777">Example button</a>
3136
```
3237

3338
## Code examples
3439

35-
List of demo code examples
40+
SourceJS code blocks are aligned with standard Markdown style. List of demo code examples:
3641

3742
```
3843
Some random code
@@ -56,7 +61,7 @@ var test = function(){};
5661
```
5762

5863
```example
59-
code example
64+
rendered example
6065
```
6166

6267
## h2

docs/spec/index.src

+17-10
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
<h1>Spec Page Documentation</h1>
22

33
<div class="source_info">
4+
<p>This page highlights the basic features of SourceJS documentation pages that we call Specs. To create your own Spec, follow this <a href="/docs/base/#creating-first-spec">short guide</a>.</p>
45

5-
<p>You can add info blocks to spec pages by adding <code>.source_info</code> to a div:</p>
6-
7-
<p>Specs are generated directly from the <span class="source_hl">/user</span> folder in Source's <a href="/docs/base#2">file structure</a>. To create a new spec page like this one, make a copy of the <a href="/docs/starting">starting template</a> folder in <span class="source_hl">/user/docs</span>.</p>
8-
6+
<p>For text description, SourceJS uses basic HTML markup, and custom CSS class hooks. To render highlighted description block like this, add <code>.source_info</code> class to a any HTML element on page.</p>
97
</div>
108

119
<div class="source_warn">
@@ -77,7 +75,7 @@
7775
</div>
7876
</div>
7977

80-
<p>To render and highlight the source code, wrap it in <code>&lt;code class="src-html"&gt;</code>, <code>&lt;code class="src-css"&gt;</code> or <code>&lt;code class="src-js"&gt;</code> tags, depending on the language you want to highlight, like this:</p>
78+
<p>To render and highlight the source code, wrap it in <code>&lt;code class="src-html"&gt;</code>, <code>&lt;code class="src-css"&gt;</code><br> or <code>&lt;code class="src-js"&gt;</code> tags, depending on the language you want to highlight, like this:</p>
8179
<code class="src-html source_visible">
8280
&lt;code class="src-html"&gt;
8381
<div class="foo">Bar</div>
@@ -107,7 +105,7 @@
107105
<section class="source_section">
108106
<h2>Linking Your Project's CSS</h2>
109107

110-
<p>Your project's CSS should be linked to each spec page to render your examples, and you can also add styles specific to a spec page:</p>
108+
<p>Your project's CSS should be linked to each spec page to render your examples using <code>/user/core/views/spec.ejs</code>, or you can also add styles specific to a spec page:</p>
111109

112110
<code class="src-html source_visible">
113111
<!-- Your project styles -->
@@ -124,9 +122,7 @@
124122
<section class="source_section">
125123
<h2>Spec Page Markup</h2>
126124

127-
<h3>Documentation Text</h3>
128-
129-
<p>Only the following tags in documentation sections are styled by Source:</p>
125+
<p>SourceJS Specs support styling of these semantic HTML tags, that you could use to describe your sections:</p>
130126

131127
<ul>
132128
<li><code>p</code></li>
@@ -142,7 +138,18 @@
142138

143139
<p>This styling <strong>is not applied inside example blocks</strong>.</p>
144140

145-
<p>Markdown support for editing documentation sections will be available within the next few updates.</p>
141+
<p>From 0.5.0 SourceJS fully supports Markdown based Specs as well. You can use <code>&lt;markdown&gt;</code> tag in any Spec templates including <code>index.src</code>, or just use <code>readme.md</code> templates instead.</p>
142+
143+
<p><a href="/docs/markdown">Read more about markdown support</a></p>
144+
145+
</section>
146+
147+
<section class="source_section">
148+
<h2>Source code</h2>
149+
150+
<p>
151+
This spec uses <code>index.src</code> template, view it's <a href="index.src">source</a>.
152+
</p>
146153

147154
</section>
148155

docs/starting-md/readme.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<link rel="stylesheet" href="css/starting.css">
22

3-
# Documentation Page
3+
# Markdown Spec Page Template
44

55
Developer: Name<br>
66
Designer: Name
@@ -15,4 +15,6 @@ Useful notes.
1515

1616
```example
1717
<p>Rendered code examples.</p>
18-
```
18+
```
19+
20+
This spec uses <code>readme.md</code> template, view it's <a href="readme.md">source</a>.

docs/starting/index.src

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<link rel="stylesheet" href="css/starting.css">
22

3-
<h1>Documentation Page</h1>
3+
<h1>Starting Spec Page Template</h1>
44

55
<div class="source_info">
66
<p>
@@ -22,4 +22,8 @@
2222
<p>Rendered code examples.</p>
2323
</div>
2424

25+
<p>
26+
This spec uses <code>index.src</code> template, view it's <a href="index.src">source</a>.
27+
</p>
28+
2529
</section>

0 commit comments

Comments
 (0)