Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/wanasit/enml-js

Evernote's ENML library in Javascript
https://github.com/wanasit/enml-js

Last synced: 17 days ago
JSON representation

Evernote's ENML library in Javascript

Awesome Lists containing this project

README

        

enml-js
===========

[Evernote's ENML](http://dev.evernote.com/doc/articles/enml.php) utitlity for Javascript.

```

> enml.ENMLOfPlainText("Hello\nWorld!!")
"\n

Hello
\n
World!!
\n"

> enml.PlainTextOfENML('\n

Hello
\n
World!!
\n')
"Hello\nWorld!!"

```

### Node.js

npm install enml-js

### Browser





Functions
============

**enml.ENMLOfPlainText**(String) - Encode a given plain text into ENML format.

**enml.PlainTextOfENML**(String) - Translate ENML content back into normal plain text.

> enml.PlainTextOfENML('\n

Hello
\n
World!!
\n')
"Hello\nWorld!!"

**enml.HTMLOfENML**(String, [ Resources ]) - Translate ENML to HTML for viewing in browsers.

> enml.HTMLOfENML('\n

Hello
\n
World!!
\n')
'
Hello
\n
World!!
\n'

This function accepts an array of Resource object from Evernote Official Javascript SDK as the second parameter. Those resources (img, audio, video) will be embeded into HTML using base64 data encoding.

```javascriptd
var client = new evernote.Client({token: AUTH_TOKEN });
var noteStore = client.getNoteStore()

noteStore.getNote(noteGuid, true, true, true, true, function(err, note){

var html = enml.HTMLOfENML(note.content, note.resources);
//...
});
```

**enml.TodosOfENML**(String) - Extract Todo items in a given ENML text.

> enml.TodosOfENML('Task1

Task2

With Bold Italic and Underline

With Color

')
[ { text: 'Task1', checked: false },
{ text: 'Task2', checked: true },
{ text: 'With Bold Italic and Underline',
checked: false },
{ text: 'With Color', checked: false } ]

**enml.CheckTodoInENML**(String, Int, Bool) - Rewrite ENML content by changing check/uncheck value of the TODO in given position.

> enml.CheckTodoInENML('Task1

Task2

With Bold Italic and Underline

With Color

',0, true )
Task1
Task2

With Bold Italic and Underline

With Color

'