Skip to content

Commit f416062

Browse files
committed
Add documentation
Closes #6
1 parent c91f7ee commit f416062

File tree

3 files changed

+132
-0
lines changed

3 files changed

+132
-0
lines changed

CONTRIBUTING.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Contributing
2+
3+
For general contributing guidelines, see the [Contributing Guide on DoneJS.com](https://donejs.com/contributing.html).
4+
5+
## Project Organization
6+
7+
bit-docs-prettify
8+
├── bit-docs.js # Registers this package into the bit-docs system as a dependency.
9+
├── prettify-engine.js # The minified JavaScript for the prettify engine from google/code-prettify.
10+
├── prettify.js # Bootstraps the prettify-engine.js and prettify.less files.
11+
├── prettify.less # The "Tomorrow Night" syntax highlight theme.
12+
└── test.js # Creates temp/index.html with <pre><code>var str ='hello world';</code></pre>
13+
# to verify that prettyprint gets applied after a timeout.
14+
15+
## Developing Locally
16+
17+
### Installing the dependencies
18+
19+
Install the packages defined in [`package.json`](package.json):
20+
21+
```shell
22+
npm install
23+
```
24+
25+
### Running the tests
26+
27+
Tests are located in [`test.js`](test.js), at the root of this repo.
28+
29+
To run the tests, execute the `test` script defined in [`package.json`](package.json):
30+
31+
```shell
32+
npm test
33+
```
34+
35+
This will produce a directory and file at `temp/index.html`, containing the source-code snippet in HTML:
36+
37+
```html
38+
<pre><code>var str ='hello world';</code></pre>
39+
```
40+
41+
Running the tests will verify that this source-code snippet in HTML is correctly prettified by the plugin.
42+
43+
In [`test.js`](test.js), the [bit-docs-generate-html](https://github.com/bit-docs/bit-docs-generate-html) plugin is generating HTML from the equivalent of this markdown:
44+
45+
```
46+
var str ='hello world';
47+
```
48+
49+
That shows how a bit-docs "generator" plugin can generate the right HTML to play nice with `bit-docs-prettify`.
50+
51+
You can open the file in your web browser to see the "pretty" result using `http-server`:
52+
53+
```shell
54+
npm install -g http-server
55+
npm test && http-server
56+
```
57+
58+
Now visit <http://127.0.0.1:8080/temp/index.html>
59+
60+
## Getting Help
61+
62+
[Our forums](http://forums.donejs.com) and [Gitter chat](https://gitter.im/donejs/donejs) are the best places to ask questions.

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2017 [Bitovi](http://bitovi.com)
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,50 @@
11
# bit-docs-prettify
2+
3+
A [bit-docs](https://github.com/bit-docs/bit-docs) plugin that makes source-code snippets in HTML prettier.
4+
5+
Powered by <https://github.com/google/code-prettify>.
6+
7+
A working demonstration is available at <https://glitch.com/edit/#!/bit-docs-prettify>.
8+
9+
## Usage
10+
11+
Add `bit-docs-prettify` as a dependency to your project's `package.json`, under the `bit-docs` section:
12+
13+
```json
14+
{
15+
"name": "your-project",
16+
...
17+
"bit-docs": {
18+
"dependencies": {
19+
"bit-docs-prettify": "*"
20+
},
21+
...
22+
}
23+
}
24+
```
25+
26+
Now use the `bit-docs` command-line tool to install the added plugin dependency:
27+
28+
```shell
29+
./node_modules/bit-docs/bin/bit-docs
30+
```
31+
32+
Your project should now support syntax highlighting of source-code snippets in the following languages:
33+
34+
bsh, c, cc, cpp, cs, csh, cyc, cv, htm, html, java, js, m, mxml, perl, pl, pm, py, rb, sh, xhtml, xml, xsl
35+
36+
Use the following HTML code to trigger syntax highlighting of a source-code snippet:
37+
38+
```html
39+
<pre><code class="language-java">...</code></pre>
40+
```
41+
42+
You can replace `language-java` with an option from the list of supported languages above, like `language-js`.
43+
44+
The code prettifier script will make an educated guess if you remove the `class="language-*"` declaration entirely.
45+
46+
## Contributing
47+
48+
Want to help make `bit-docs-prettify` even better? See [`CONTRIBUTING.md`](CONTRIBUTING.md).
49+
50+
Looking for a changelog? Try the [releases page on GitHub](https://github.com/bit-docs/bit-docs-prettify/releases).

0 commit comments

Comments
 (0)