GithubHelp home page GithubHelp logo

enml-js's Introduction

enml-js

Evernote's ENML library in Javascript.

INSTALLATION

Node.js

npm install enml-js

Browser

<script src="https://raw.github.com/berryboy/enml-js/master/enml.js"></script>
<script src="https://raw.github.com/berryboy/enml-js/master/lib/xml-writer.js"></script>
<script src="https://raw.github.com/berryboy/enml-js/master/lib/xml-parser.js"></script>

Functions

enml.ENMLOfPlainText(String) - Encode plain text in ENML format.

> enml.ENMLOfPlainText("Hello  World!!")
'<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd">\n<en-note style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Hello  World!!</div>\n</en-note>'

> enml.ENMLOfPlainText("Hello\nWorld!!")
'<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd">\n<en-note style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Hello</div>\n<div>World!!</div>\n</en-note>'

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

    > enml.PlainTextOfENML('<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd">\n<en-note style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Hello</div>\n<div>World!!</div>\n</en-note>')
    ' Hello World!! '

enml.HTMLOfENML(String, [ Map <String, {url: String, title: String}> ]) - Translate ENML to HTML for viewing in browsers. To show resources you have to provide a map of resources' hash and their src url and title.

> enml.HTMLOfENML('<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd">\n<en-note style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Hello</div>\n<div>World!!</div>\n</en-note>')
'<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Hello</div>\n<div>World!!</div>\n</body></html>'

enml.TodosOfENML(String) - Extract data of all TODO(s) in ENML text.

> enml.TodosOfENML('<en-note style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><en-todo/>Task1<div><en-todo checked="true"/>Task2<br/></div><div><en-todo/>With <b>Bold</b> <i>Italic</i> and <u>Underline</u><br/></div><div><u><en-todo/></u>With <font color="#FF2600">Color</font><br/></div></en-note>')
[ { 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('<en-note style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><en-todo/>Task1<div><en-todo checked="true"/>Task2<br/></div><div><en-todo/>With <b>Bold</b> <i>Italic</i> and <u>Underline</u><br/></div><div><u><en-todo/></u>With <font color="#FF2600">Color</font><br/></div></en-note>',
      0, true )
      <en-note style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><en-todo checked="true"/>Task1<div><en-todo checked="true"/>Task2<br/></div><div><en-todo/>With <b>Bold</b> <i>Italic</i> and <u>Underline</u><br/></div><div><u><en-todo/></u>With <font color="#FF2600">Color</font><br/></div></en-note>'

enml-js's People

Contributors

wanasit avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.