@@ -8,12 +8,11 @@ var codes = require('micromark/dist/character/codes')
8
8
var constants = require ( 'micromark/dist/constant/constants' )
9
9
var own = require ( 'micromark/dist/constant/has-own-property' )
10
10
var types = require ( 'micromark/dist/constant/types' )
11
- var flatMap = require ( 'micromark/dist/util/flat-map' )
12
11
var normalizeIdentifier = require ( 'micromark/dist/util/normalize-identifier' )
13
12
var safeFromInt = require ( 'micromark/dist/util/safe-from-int' )
14
13
var parser = require ( 'micromark/dist/parse' )
15
14
var preprocessor = require ( 'micromark/dist/preprocess' )
16
- var postprocessor = require ( 'micromark/dist/postprocess' )
15
+ var postprocess = require ( 'micromark/dist/postprocess' )
17
16
18
17
function fromMarkdown ( value , encoding , options ) {
19
18
if ( typeof encoding !== 'string' ) {
@@ -22,11 +21,8 @@ function fromMarkdown(value, encoding, options) {
22
21
}
23
22
24
23
return compiler ( options ) (
25
- postprocessor ( ) (
26
- flatMap (
27
- flatMap ( [ value , codes . eof ] , preprocessor ( ) , encoding ) ,
28
- parser ( options ) . document ( ) . write
29
- )
24
+ postprocess (
25
+ parser ( options ) . document ( ) . write ( preprocessor ( ) ( value , encoding , true ) )
30
26
)
31
27
)
32
28
}
@@ -155,8 +151,6 @@ function compiler(options) {
155
151
while ( ++ index < events . length ) {
156
152
event = events [ index ]
157
153
158
- if ( ! event ) break
159
-
160
154
// We preprocess lists to add `listItem` tokens, and to infer whether
161
155
// items the list itself are spread out.
162
156
if (
@@ -173,7 +167,7 @@ function compiler(options) {
173
167
}
174
168
175
169
index = - 1
176
- length = events . length - 1
170
+ length = events . length
177
171
178
172
while ( ++ index < length ) {
179
173
handler = config [ events [ index ] [ 0 ] ]
0 commit comments