Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Commit

Permalink
Update micromark
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Sep 29, 2020
1 parent 3b265c5 commit 40f8722
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 17 deletions.
44 changes: 28 additions & 16 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ module.exports = footnote

var normalizeIdentifier = require('micromark/dist/util/normalize-identifier')
var blank = require('micromark/dist/tokenize/partial-blank-line')
var createSpaceTokenizer = require('micromark/dist/tokenize/partial-space')
var createSpace = require('micromark/dist/tokenize/factory-space')
var chunkedSplice = require('micromark/dist/util/chunked-splice')
var prefixSize = require('micromark/dist/util/prefix-size')
var shallow = require('micromark/dist/util/shallow')
var resolveAll = require('micromark/dist/util/resolve-all')
Expand Down Expand Up @@ -90,22 +91,36 @@ function resolveToNoteEnd(events, context) {
end: shallow(events[events.length - 3][1].start)
}

return [].concat(
events.slice(0, openIndex),
[['enter', group, context]],
// Opening markers.
events.slice(openIndex + 1, openIndex + 5),
[['enter', text, context]],
var note = [
['enter', group, context],
events[openIndex + 1],
events[openIndex + 2],
events[openIndex + 3],
events[openIndex + 4],
['enter', text, context]
]

chunkedSplice(
note,
note.length,
0,
resolveAll(
context.parser.constructs.insideSpan.null,
events.slice(openIndex + 6, -4),
context
),
[['exit', text, context]],
// Closing marker.
events.slice(-3),
[['exit', group, context]]
)
)

note.push(
['exit', text, context],
events[events.length - 2],
events[events.length - 3],
['exit', group, context]
)

chunkedSplice(events, index, events.length - index, note)

return events
}

function tokenizeFootnoteCall(effects, ok, nok) {
Expand Down Expand Up @@ -417,10 +432,7 @@ function footnoteDefinitionEnd(effects) {
function tokenizeIndent(effects, ok, nok) {
var self = this

return effects.attempt(
createSpaceTokenizer('footnoteDefinitionIndent', 5),
afterPrefix
)
return createSpace(effects, afterPrefix, 'footnoteDefinitionIndent', 5)

function afterPrefix(code) {
return prefixSize(self.events, 'footnoteDefinitionIndent') === 4
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"html.js"
],
"dependencies": {
"micromark": "~2.8.0"
"micromark": "~2.9.0"
},
"devDependencies": {
"nyc": "^15.0.0",
Expand Down

0 comments on commit 40f8722

Please sign in to comment.