markup-it
markup-it copied to clipboard
Example from documentation crashes with TypeError
This example currently breaks with
TypeError: Expected Array or iterable object of values: [object Object]
RunKit Link showing full stack trace
const { State } = require('markup-it');
const markdown = require('markup-it/lib/markdown');
const state = State.create(markdown);
const document = state.deserializeToDocument('Hello **World**');
I've tried with [email protected]
and [email protected]
, and @gitbook/[email protected]
and @gitbook/[email protected]
.
the same to me, any updates? @tolmasky
I've not gotten it to work. Sticking with remark for now, but want to eventually switch to markup-it for template support.
Hi, I would like to try this compiler (and then add support for textile (JIRA format)). But I got stuck on this error. Is there any progress? @Soreine
@tolmasky Indeed, it doesn't work.
markup-it/lib/markdown
is using ES6 Modules:
import block from './blocks';
import inline from './inlines';
import document from './document';
export default {
document: [document],
inline,
block
};
Once converted by Babel into CommonJS, the exported object becomes:
{
"default": {
"document": ...,
"inline": ...,
"block": ...
}
}
So, in order to make it works you can either replace State.create(markdown)
by State.create(markdown.default)
or use ES6 modules:
import { State } from 'markup-it'
import markdown from 'markup-it/lib/markdown'
import { Map, List } from 'immutable'
const state = State.create(markdown);
const doc = state.deserializeToDocument('Hello **World**');