Skip to content

Commit

Permalink
improve readme (#3)
Browse files Browse the repository at this point in the history
improve package description, extend README
  • Loading branch information
connium authored Jan 12, 2018
1 parent 103643e commit 0fbbd43
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 37 deletions.
89 changes: 53 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,60 +1,77 @@
simple-odf
==========
# simple-odf

Open Document Format made easy using pure JavaScript and Node.js

[![Dependencies](https://david-dm.org/connium/simple-odf.svg)](https://david-dm.org/connium/simple-odf)
[![Known Vulnerabilities](https://snyk.io/test/github/connium/simple-odf/badge.svg)](https://snyk.io/test/github/connium/simple-odf)
[![Version](https://img.shields.io/npm/v/simple-odf.svg)](https://www.npmjs.com/package/simple-odf)

## What is simple-odf?
## Getting Started

simple-odf is an easy-to-use, high-level Node.js based API for creating documents in Open Document Format (ODF).
Install simple-odf using [`npm`](https://www.npmjs.com/):

It is written in TypeScript and compiled to pure JavaScript.
```
npm install --save simple-odf
```

Till now, we support APIs to create text document, paragraph and headline.
Create your first document.

## Cookbook
```javascript
const simpleOdf = require("simple-odf");

### Text Document
The following codes generates an empty text document:
const document = new simpleOdf.TextDocument();

```javascript
const document = new TextDocument();
document.addHeadline("My First Document");

document.save('/home/homer/My_first_document.fodf');
```
const p1 = document.addParagraph("The quick, brown fox jumps over a lazy dog.");
p1.appendTextContent("\nThe five boxing wizards jump quickly");

### Paragraph
The following code adds a new and empty paragraph to the end of the document.
document.addHeadline("Credits", 2);

```javascript
document.addParagraph();
```
document.addParagraph("This was quite easy. Do you want to know why?");

To add a paragraph with the corresponding text, the following code can be used:
const list = document.addList();
list.addItem("one-liner setup");
list.addItem("just write like you would do in a full-blown editor");

```javascript
document.addParagraph("The quick, brown fox jumps over a lazy dog.");
document.saveFlat("/home/homer/My_first_document.fodf");
```

### Headline
The following code adds a new and empty headline with headling level 1 to the end of the document.
## Contributing

```javascript
document.addHeadline();
```
If you want to contribute to simple-odf, you are very welcome. Send issues and pull requests with your ideas.

To add a headline with the corresponding text and headling level 2, the following code can be used:
### Pull Requests

```javascript
document.addHeadline("Second order headline", 2);
```
*Before* submitting a pull request, please make sure the following is done...

The following code gets the current heading level and changes it to level 3.
1. Fork the repo and create your branch from `master`. A guide on how to fork a
repository: https://help.github.com/articles/fork-a-repo/

```javascript
const headingLevel = heading.getHeadingLevel();
console.log("The headling level of heading is " + headingLevel + ".");
Open terminal and type:

heading.setHeadingLevel(3);
```
```sh
git clone https://github.com/<your_username>/simple-odf
cd simple-odf
git checkout -b my_branch
```

2. simple-odf uses [npm](https://www.npmjs.com) for
running development scripts. If you haven't already done so, please
[install npm](https://docs.npmjs.com/).

3. Run `npm install`.

```sh
npm install
```

4. If you've added code, add tests. You can use watch mode that continuously observes changed files to make your life easier.

```sh
npm test -- --watch
```

### License

By contributing to simple-odf, you agree that your contributions will be licensed under its MIT license.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "simple-odf",
"version": "0.1.0",
"description": "Library for creating files in Open Document Format",
"description": "Open Document Format made easy using pure JavaScript and Node.js",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"scripts": {
Expand Down

0 comments on commit 0fbbd43

Please sign in to comment.