diff --git a/README.md b/README.md index 16ef0f61..5d8677de 100644 --- a/README.md +++ b/README.md @@ -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//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. diff --git a/package.json b/package.json index bb54ed78..9ac3bb07 100644 --- a/package.json +++ b/package.json @@ -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": {