updating documentation

master
Matt Huntington 10 years ago
parent df5b744d9c
commit 6f09f26eb9

@ -11,31 +11,73 @@ This NPM library is just a single function that implements the CML spec by conve
- require the module, then call it. - require the module, then call it.
```javascript ```javascript
var converter = require('cml-html-converter'); var converter = require('cml-html-converter');
var exampleCMLString = var exampleString = "if the first line contains a line break after it, it is rendered as a header\n" +
'item one of root list\n' + //no indentation "\n" +
'\titem one of 1st nested list\n' + //indented once "sub headings are single lines that have a line break before and after them, but are not the first line\n" +
'\t\titem one of 2nd nested list\n' + //indented twice "\n" +
'\titem two of 1st nested list' //indented once "This single line contains a period. Therefore, it is rendered as a paragraph. It also contains a link to http://www.google.com, so that is rendered appropriately.\n"+
"\n" +
"lines that either directly preceed another line of text\n" +
" or directly succeed another line of text\n" +
" are rendered as lists\n" +
" they can also contain links http://www.google.com\n" +
" you can only forward indent\n" +
" one tab\n" +
" at a\n" +
" time\n" +
" but you can back indent as much as you'd like\n" +
"\n" +
"sub heading 2\n";
ub heading 2';
var htmlString = converter(exampleCMLString); var htmlString = converter(exampleCMLString);
``` ```
- in the example above `htmlString` should look something like this: - in the example above `htmlString` should look something like this:
```html ```html
<h1>if the first line contains a line break after it, it is rendered as a header</h1>
<h2>sub headings are single lines that have a line break before and after them, but are not the first line</h2>
<p>This single line contains a period. Therefore, it is rendered as a paragraph. It also contains a link to <a href="http://www.google.com">http://www.google.com</a>, so that is rendered appropriately.</p>
<ul> <ul>
<li> <li>
item one of root list lines that either directly preceed another line of text
<ul> <ul>
<li> <li>
item two of 1st nested list or directly succeed another line of text
<ul> <ul>
<li> <li>
item one of 2nd nested list are rendered as lists
<ul>
<li>
they can also contain links <a href="http://www.google.com">http://www.google.com</a>
<ul>
<li>
you can only forward indent
<ul>
<li>
one tab
<ul>
<li>
at a
<ul>
<li>
time
</li>
</ul>
</li>
</ul>
</li> </li>
</ul> </ul>
</li> </li>
<li> <li>
item two of 1st nested list but you can back indent as much as you'd like
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li> </li>
</ul> </ul>
</li> </li>
</ul> </ul>
<h2>sub heading 2</h2>
``` ```

Loading…
Cancel
Save