npm install cml-html-converternpm install cml-html-converterjavascript
var converter = require('cml-html-converter');
var exampleString = "if the first line contains a line break after it, it is rendered as a header\n" +
"\n" +
"sub headings are single lines that have a line break before and after them, but are not the first line\n" +
"\n" +
"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";
var htmlString = converter(exampleCMLString);
`
- in the example above htmlString should look something like this:
`html
if the first line contains a line break after it, it is rendered as a header
sub headings are single lines that have a line break before and after them, but are not the first line
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.
lines that either directly preceed another line of text
or directly succeed another line of text
are rendered as lists
they can also contain links http://www.google.com
you can only forward indent
one tab
at a
time
but you can back indent as much as you'd like
sub heading 2
``