packages/remark-parse/lib/tokenize/list.js
function normalListItem(ctx, value, position) {
  var offsets = ctx.offset
  var line = position.line
  var max
  var bullet
  var rest
  var lines
  var trimmedLines
  var index
  var length

  // Remove the list-item’s bullet.
  value = value.replace(bulletExpression, replacer)

  lines = value.split(lineFeed)

  trimmedLines = removeIndent(value, getIndent(max).indent).split(lineFeed)

  // We replaced the initial bullet with something else above, which was used
  // to trick `removeIndentation` into removing some more characters when
  // possible.  However, that could result in the initial line to be stripped
  // more than it should be.
  trimmedLines[0] = rest

  offsets[line] = (offsets[line] || 0) + bullet.length
  line++

  index = 0
  length = lines.length

  while (++index < length) {
    offsets[line] =
      (offsets[line] || 0) + lines[index].length - trimmedLines[index].length
    line++
  }

  return trimmedLines.join(lineFeed)

  function replacer($0, $1, $2, $3, $4) {
    bullet = $1 + $2 + $3
    rest = $4

    // Make sure that the first nine numbered list items can indent with an
    // extra space.  That is, when the bullet did not receive an extra final
    // space.
    if (Number($2) < 10 && bullet.length % 2 === 1) {
      $2 = space + $2
    }

    max = $1 + repeat(space, $2.length) + $3

    return max + rest
  }
}
function normalListItem(ctx, value, position) {
  var offsets = ctx.offset
  var line = position.line
  var max
  var bullet
  var rest
  var lines
  var trimmedLines
  var index
  var length

  // Remove the list-item’s bullet.
  value = value.replace(bulletExpression, replacer)

  lines = value.split(lineFeed)

  trimmedLines = removeIndent(value, getIndent(max).indent).split(lineFeed)

  // We replaced the initial bullet with something else above, which was used
  // to trick `removeIndentation` into removing some more characters when
  // possible.  However, that could result in the initial line to be stripped
  // more than it should be.
  trimmedLines[0] = rest

  offsets[line] = (offsets[line] || 0) + bullet.length
  line++

  index = 0
  length = lines.length

  while (++index < length) {
    offsets[line] =
      (offsets[line] || 0) + lines[index].length - trimmedLines[index].length
    line++
  }

  return trimmedLines.join(lineFeed)

  function replacer($0, $1, $2, $3, $4) {
    bullet = $1 + $2 + $3
    rest = $4

    // Make sure that the first nine numbered list items can indent with an
    // extra space.  That is, when the bullet did not receive an extra final
    // space.
    if (Number($2) < 10 && bullet.length % 2 === 1) {
      $2 = space + $2
    }

    max = $1 + repeat(space, $2.length) + $3

    return max + rest
  }
}
function normalListItem ( ctx , value , position ) { var offsets = ctx . offset var line = position . line var max var bullet var rest var lines var trimmedLines var index var length // Remove the list-item’s bullet. value = value . replace ( bulletExpression , replacer ) lines = value . split ( lineFeed ) trimmedLines = removeIndent ( value , getIndent ( max ) . indent ) . split ( lineFeed ) // We replaced the initial bullet with something else above, which was used // to trick `removeIndentation` into removing some more characters when // possible.  However, that could result in the initial line to be stripped // more than it should be. trimmedLines [ 0 ] = rest offsets [ line ] = ( offsets [ line ] || 0 ) + bullet . length line ++ index = 0 length = lines . length while ( ++ index < length ) { offsets [ line ] = ( offsets [ line ] || 0 ) + lines [ index ] . length - trimmedLines [ index ] . length line ++ } return trimmedLines . join ( lineFeed ) function replacer ( $0 , $1 , $2 , $3 , $4 ) { bullet = $1 + $2 + $3 rest = $4 // Make sure that the first nine numbered list items can indent with an // extra space.  That is, when the bullet did not receive an extra final // space. if ( Number ( $2 ) < 10 && bullet . length % 2 === 1 ) { $2 = space + $2 } max = $1 + repeat ( space , $2 . length ) + $3 return max + rest } }
Create a list-item using sane mechanics.
Create a list - item using sane mechanics .