partial-blank-line.js 586 B

123456789101112131415161718192021
  1. 'use strict'
  2. var codes = require('../character/codes.js')
  3. var markdownLineEnding = require('../character/markdown-line-ending.js')
  4. var types = require('../constant/types.js')
  5. var factorySpace = require('./factory-space.js')
  6. var partialBlankLine = {
  7. tokenize: tokenizePartialBlankLine,
  8. partial: true
  9. }
  10. function tokenizePartialBlankLine(effects, ok, nok) {
  11. return factorySpace(effects, afterWhitespace, types.linePrefix)
  12. function afterWhitespace(code) {
  13. return code === codes.eof || markdownLineEnding(code) ? ok(code) : nok(code)
  14. }
  15. }
  16. module.exports = partialBlankLine