Skip to content

Commit 78b970a

Browse files
committed
Update docs
1 parent 114e4c9 commit 78b970a

File tree

3 files changed

+82
-53
lines changed

3 files changed

+82
-53
lines changed

bit-docs.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
/**
2-
* @module {function} bit-docs-prettify
32
* @parent plugins
3+
* @module {function} bit-docs-prettify
4+
* @group bit-docs-prettify/static static
45
*
56
* @description A bit-docs plugin that makes source-code snippets in HTML prettier.
6-
*
7+
*
78
* @body
8-
*
9-
* TBD
9+
*
10+
* This plugin registers onto the `html` hook.
11+
*
12+
* Registering the `html` hook adds a static JavaScript file
13+
* [bit-docs-prettify/prettify.js] that will go through every `<code>` element
14+
* on the page applying the
15+
* [code prettifier](https://github.com/google/code-prettify).
1016
*/
1117
module.exports = function(bitDocs){
1218
var pkg = require("./package.json");

prettify.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
require("./prettify-engine");
22
require("./prettify.less")
33

4+
/**
5+
* @parent bit-docs-prettify/static
6+
* @module {function} bit-docs-prettify/prettify.js
7+
*
8+
* Main front end JavaScript file for static portion of this plugin.
9+
*
10+
* @signature `prettyPrint()`
11+
*
12+
* Finds all `<code>` elements on the page and adds the `prettyprint` class
13+
* before executing the required pretty print engine.
14+
*
15+
* Also requires [bit-docs-prettify/prettify.less].
16+
*/
417
module.exports = function(){
518
var codes = document.getElementsByTagName("code");
619
for(var i = 0; i < codes.length; i ++){

prettify.less

Lines changed: 59 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,65 @@
11
@import "locate://bit-docs-site/styles/variables.less";
22

33
/**
4-
* @stylesheet code.less Code Rendering
5-
* @parent Styles.baseline-elements
6-
*
7-
* @description
8-
* Enables both the layout of code wells, and also the syntax highlighting of the specific code language. Syntax coloring provided by prettify.js with the <a href="https://github.com/chriskempson/tomorrow-theme">Tomorrow Theme</a>.
9-
*
10-
* Code "wells" are styled based on the use of the `<pre>` and `<code>` tags around your desired code example.
11-
*
12-
* Below are a few examples in various languages. This is not an exhaustive list of supported languages.
13-
*
14-
* ### HTML
15-
* ```
16-
* <pre>
17-
<code>
18-
<div class="example"><!--with a comment -->
19-
<h1>Example</h1>
20-
<p>This is some example code that is being styled.</p>
21-
</div>
22-
</code>
23-
</pre>
24-
*
25-
* ```
26-
* ### JavaScript
27-
*```
28-
var foo = require('f'),
29-
bar = require('br'),
30-
writeFile = f.denodify(br.writeFile),
31-
path = require('path');
32-
33-
module.exports = function(littlePromise, options){
34-
return littlePromise.then(function(little){
35-
return writeFile(
36-
path.join(options.dest,'little.json'),
37-
JSON.stringify(little) );
38-
});
39-
};
40-
* ```
41-
* ### JSON
42-
*```
43-
{
44-
"sites": {
45-
"docs": {
46-
"key" : "value"
47-
}
48-
}
49-
}
50-
* ```
51-
*
52-
**/
4+
* @parent bit-docs-prettify/static
5+
* @module bit-docs-prettify/prettify.less
6+
*
7+
* @description Layout of code wells and syntax highlighting of code languages.
8+
*
9+
* @body
10+
*
11+
* Syntax highlighting and colors provided by
12+
* [JavaScript code prettifier](https://github.com/google/code-prettify) and
13+
* [Tomorrow Theme](https://github.com/chriskempson/tomorrow-theme).
14+
*
15+
* Code "wells" are styled based on the use of the `<pre>` and `<code>` tags
16+
* around your desired code example.
17+
*
18+
* Below are examples in a few of the supported languages.
19+
*
20+
* ### HTML
21+
*
22+
* ```html
23+
* <pre>
24+
* <code>
25+
* <div class="example"><!--with a comment -->
26+
* <h1>example</h1>
27+
* <p>this is some example code that is being styled.</p>
28+
* </div>
29+
* </code>
30+
* </pre>
31+
*
32+
* ```
33+
*
34+
* ### JavaScript
35+
*
36+
*```js
37+
* var foo = require('f'),
38+
* bar = require('br'),
39+
* writefile = f.denodify(br.writefile),
40+
* path = require('path');
41+
*
42+
* module.exports = function(littlepromise, options){
43+
* return littlepromise.then(function(little){
44+
* return writefile(
45+
* path.join(options.dest,'little.json'),
46+
* json.stringify(little) );
47+
* });
48+
* };
49+
* ```
50+
*
51+
* ### JSON
52+
*
53+
*```json
54+
* {
55+
* "sites": {
56+
* "docs": {
57+
* "key" : "value"
58+
* }
59+
* }
60+
* }
61+
* ```
62+
*/
5363
code {
5464
background-color: @colorCode;
5565
border-radius: 5px;

0 commit comments

Comments
 (0)