cycle-markdown-driver
v0.0.13
Published
cycle.js driver for markdown
Downloads
19
Readme
Cycle Markdown Driver
A Cycle.js Driver for parsing Markdown from text. This package is small, and untested.
npm install cycle-markdown-driver
Usage
import Cycle, {Rx} from '@cycle/core';
import {makeDOMDriver} from '@cycle/dom';
import {makeMarkdownDriver} from 'cycle-markdown-driver';
function main(responses) {
const keydownOnTextarea$ = DOM.select('#raw').events('keydown')
.debounce(500)
.map(e => e.target.value)
.filter(query => query.length > 0)
const vtree$ = responses.MARKDOWN
.mergeAll()
.map(res => {
h('div.container', [
h('p', res.content)
])
});
return {
DOM: vtree$,
MARKDOWN: keydownOnTextarea$
};
}
Cycle.run(main, {
DOM: makeDOMDriver('.js-container'),
MARKDOWN: makeMarkdownDriver()
})