1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- import {combineExtensions} from 'micromark-util-combine-extensions'
- import {content} from './initialize/content.js'
- import {document} from './initialize/document.js'
- import {flow} from './initialize/flow.js'
- import {string, text} from './initialize/text.js'
- import {createTokenizer} from './create-tokenizer.js'
- import * as defaultConstructs from './constructs.js'
- export function parse(options) {
- const settings = options || {}
- const constructs =
-
- combineExtensions([defaultConstructs, ...(settings.extensions || [])])
-
- const parser = {
- defined: [],
- lazy: {},
- constructs,
- content: create(content),
- document: create(document),
- flow: create(flow),
- string: create(string),
- text: create(text)
- }
- return parser
-
- function create(initial) {
- return creator
-
- function creator(from) {
- return createTokenizer(parser, initial, from)
- }
- }
- }
|