{"_id":"@cjser/micromark-factory-space","_rev":"2-1a839bce057ab8e0e750b0809573bac4","name":"@cjser/micromark-factory-space","dist-tags":{"latest":"2.1.0-cjser.2"},"versions":{"2.0.1-cjser.2":{"name":"@cjser/micromark-factory-space","version":"2.0.1-cjser.2","keywords":["micromark","factory","space"],"author":{"url":"https://wooorm.com","name":"Titus Wormer","email":"tituswormer@gmail.com"},"license":"MIT","_id":"@cjser/micromark-factory-space@2.0.1-cjser.2","maintainers":[{"name":"nanahira","email":"nanahira@momobako.com"}],"contributors":[{"url":"https://wooorm.com","name":"Titus Wormer","email":"tituswormer@gmail.com"}],"bugs":{"url":"https://github.com/micromark/micromark/issues"},"xo":{"envs":["shared-node-browser"],"rules":{"unicorn/prefer-code-point":"off"},"prettier":true},"dist":{"shasum":"e5111b51892ca4130d199ac19a0102d00704db0f","tarball":"https://registry.npmjs.org/@cjser/micromark-factory-space/-/micromark-factory-space-2.0.1-cjser.2.tgz","fileCount":10,"integrity":"sha512-0pHl1fLPgRDJrie9DF9fV/wqnDeIX01q7RMA/GAB85OpFzaqLu28q7sMFOPRUYNK8ACCtZHrRZFojOmCgYnfBw==","signatures":[{"sig":"MEUCIQCeoYvsy3Bakj80Zi+64fs9zL1RiZPIEHDLXAVCVTKHCwIgf1s6WfmromixR635bz3KOZqC1QuosEZqBKO8S7o7CvQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":16678},"main":"./dist-cjser/index.cjs","type":"module","cjser":{"original":{"name":"micromark-factory-space","files":["dev/","index.d.ts.map","index.d.ts","index.js"],"exports":{"default":"./index.js","development":"./dev/index.js"},"scripts":{"build":"micromark-build"},"version":"2.0.1","repository":"https://github.com/micromark/micromark/tree/main/packages/micromark-factory-space","dependencies":{"micromark-util-types":"^2.0.0","micromark-util-character":"^2.0.0"}},"cjserVersion":2,"sourceVersion":"2.0.1"},"exports":{"default":"./index.js","require":"./dist-cjser/index.cjs","development":"./dev/index.js"},"funding":[{"url":"https://github.com/sponsors/unifiedjs","type":"GitHub Sponsors"},{"url":"https://opencollective.com/unified","type":"OpenCollective"}],"gitHead":"a4bef54d7d22d3d9a6b84528457938d84cd65fe7","scripts":{"build":"micromark-build"},"_npmUser":{"name":"nanahira","email":"nanahira@momobako.com"},"repository":{"url":"https://code.moenext.com/3rdeye/cjser.git","type":"git"},"_npmVersion":"11.9.0","description":"micromark factory to parse markdown space (found in lots of places)","directories":{},"sideEffects":false,"_nodeVersion":"24.14.0","dependencies":{"@cjser/micromark-util-types":"2.0.2-cjser.2","@cjser/micromark-util-character":"2.1.1-cjser.2"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/micromark-factory-space_2.0.1-cjser.2_1778864983592_0.1741224549834386","host":"s3://npm-registry-packages-npm-production"}},"2.1.0-cjser.2":{"_id":"@cjser/micromark-factory-space@2.1.0-cjser.2","bugs":{"url":"https://github.com/micromark/micromark/issues"},"dist":{"shasum":"a55a79f37c249cada6d0e821a9f4947215f13b65","tarball":"https://registry.npmjs.org/@cjser/micromark-factory-space/-/micromark-factory-space-2.1.0-cjser.2.tgz","fileCount":10,"integrity":"sha512-76qnmLbp3wbUwUziNKJwtC+q5VSssxVLrw2UyvBTyRh2U7RHWB12wqx1OLn2KA3X9mfM866L8CEzOoVUUKi1AQ==","signatures":[{"sig":"MEYCIQDZx6YwQ3UDxufCtntCt2bQgoeRJ5jGla1ma6G1a5/c4gIhAKBnO66kFMmdk+b3HzbQ30o4hk3lh56LFgMucY8al/02","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIFGvU+qw3OVXdQoQ4pILZ7I7qvyqxxCcAGWk5LWj+gUAAiA5LvubGlbLx07YkFklC17X7sAqIP8ZpCI+Bl88B5P/zw=="}],"unpackedSize":21420},"main":"./dist-cjser/index.cjs","name":"@cjser/micromark-factory-space","type":"module","cjser":{"original":{"name":"micromark-factory-space","files":["dev/","index.d.ts.map","index.d.ts","index.js"],"exports":{"default":"./index.js","development":"./dev/index.js"},"scripts":{"build":"micromark-build"},"version":"2.1.0","repository":"https://github.com/micromark/micromark/tree/main/packages/micromark-factory-space","dependencies":{"micromark-util-types":"^2.0.0","micromark-util-character":"^2.0.0"}},"cjserVersion":2,"sourceVersion":"2.1.0"},"author":{"url":"https://wooorm.com","name":"Titus Wormer","email":"tituswormer@gmail.com"},"exports":{"default":"./index.js","require":"./dist-cjser/index.cjs","development":"./dev/index.js"},"funding":[{"url":"https://github.com/sponsors/unifiedjs","type":"GitHub Sponsors"},{"url":"https://opencollective.com/unified","type":"OpenCollective"}],"gitHead":"a4bef54d7d22d3d9a6b84528457938d84cd65fe7","license":"MIT","scripts":{"build":"micromark-build"},"version":"2.1.0-cjser.2","_npmUser":{"name":"nanahira","email":"nanahira@momobako.com"},"keywords":["micromark","factory","space"],"repository":{"url":"https://code.moenext.com/3rdeye/cjser.git","type":"git"},"_npmVersion":"10.7.0","description":"micromark factory to parse markdown space (found in lots of places)","directories":{},"maintainers":[{"name":"nanahira","email":"nanahira@momobako.com"}],"sideEffects":false,"_nodeVersion":"20.14.0","contributors":[{"url":"https://wooorm.com","name":"Titus Wormer","email":"tituswormer@gmail.com"}],"dependencies":{"@cjser/micromark-util-types":"2.0.3-cjser.2","@cjser/micromark-util-character":"2.1.1-cjser.2"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/micromark-factory-space_2.1.0-cjser.2_1790447484481_0.8593794293667962"}}},"time":{"created":"2026-05-15T17:09:43.367Z","modified":"2026-09-26T18:31:24.741Z","2.0.1-cjser.2":"2026-05-15T17:09:43.777Z","2.1.0-cjser.2":"2026-09-26T18:31:24.555Z"},"bugs":{"url":"https://github.com/micromark/micromark/issues"},"author":{"url":"https://wooorm.com","name":"Titus Wormer","email":"tituswormer@gmail.com"},"license":"MIT","keywords":["micromark","factory","space"],"repository":{"url":"https://code.moenext.com/3rdeye/cjser.git","type":"git"},"description":"micromark factory to parse markdown space (found in lots of places)","contributors":[{"url":"https://wooorm.com","name":"Titus Wormer","email":"tituswormer@gmail.com"}],"maintainers":[{"name":"nanahira","email":"nanahira@momobako.com"}],"readme":"# micromark-factory-space\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][bundle-size-badge]][bundle-size]\n[![Sponsors][sponsors-badge]][opencollective]\n[![Backers][backers-badge]][opencollective]\n[![Chat][chat-badge]][chat]\n\n[micromark][] factory to parse [markdown space][markdown-space] (found in lots\nof places).\n\n## Contents\n\n* [What is this?](#what-is-this)\n* [When should I use this?](#when-should-i-use-this)\n* [Install](#install)\n* [Use](#use)\n* [API](#api)\n  * [`factorySpace(…)`](#factoryspace)\n* [Types](#types)\n* [Compatibility](#compatibility)\n* [Security](#security)\n* [Contribute](#contribute)\n* [License](#license)\n\n## What is this?\n\nThis package exposes states to parse spaces and/or tabs.\n\n## When should I use this?\n\nThis package is useful when you are making your own micromark extensions.\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install micromark-factory-space\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport {factorySpace} from 'https://esm.sh/micromark-factory-space@1'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n<script type=\"module\">\n  import {factorySpace} from 'https://esm.sh/micromark-factory-space@1?bundle'\n</script>\n```\n\n## Use\n\n```js\nimport {factorySpace} from 'micromark-factory-space'\nimport {codes, types} from 'micromark-util-symbol'\n\n// A micromark tokenizer that uses the factory:\n/**\n * @this {TokenizeContext}\n *   Context.\n * @type {Tokenizer}\n */\nfunction tokenizeCodeFenced(effects, ok, nok) {\n  return start\n\n  // …\n\n  /** @type {State} */\n  function info(code) {\n    if (code === codes.eof || markdownLineEndingOrSpace(code)) {\n      effects.exit(types.chunkString)\n      effects.exit(types.codeFencedFenceInfo)\n      return factorySpace(effects, infoAfter, types.whitespace)(code)\n    }\n\n    if (code === codes.graveAccent && code === marker) return nok(code)\n    effects.consume(code)\n    return info\n  }\n\n  // …\n}\n```\n\n## API\n\nThis module exports the identifier [`factorySpace`][api-factory-space].\nThere is no default export.\n\n### `factorySpace(…)`\n\nParse spaces and tabs.\n\nThere is no `nok` parameter:\n\n* spaces in markdown are often optional, in which case this factory can be\n  used and `ok` will be switched to whether spaces were found or not\n* one line ending or space can be detected with `markdownSpace(code)` right\n  before using `factorySpace`\n\n###### Examples\n\nWhere `␉` represents a tab (plus how much it expands) and `␠` represents a\nsingle space.\n\n```markdown\n␉\n␠␠␠␠\n␉␠\n```\n\n###### Parameters\n\n* `effects` (`Effects`)\n  — context\n* `ok` (`State`)\n  — state switched to when successful\n* `type` (`string`)\n  — type (`' \\t'`)\n* `max` (`number`, default: `Infinity`)\n  — max (exclusive)\n\n###### Returns\n\nStart state (`State`).\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports no additional types.\n\n## Compatibility\n\nProjects maintained by the unified collective are compatible with maintained\nversions of Node.js.\n\nWhen we cut a new major release, we drop support for unmaintained versions of\nNode.\nThis means we try to keep the current release line,\n`micromark-factory-space@2`, compatible with Node.js 16.\nThis package works with `micromark@3`.\n\n## Security\n\nThis package is safe.\nSee [`security.md`][securitymd] in [`micromark/.github`][health] for how to\nsubmit a security report.\n\n## Contribute\n\nSee [`contributing.md`][contributing] in [`micromark/.github`][health] for ways\nto get started.\nSee [`support.md`][support] for ways to get help.\n\nThis project has a [code of conduct][coc].\nBy interacting with this repository, organisation, or community you agree to\nabide by its terms.\n\n## License\n\n[MIT][license] © [Titus Wormer][author]\n\n<!-- Definitions -->\n\n[api-factory-space]: #factoryspace\n\n[author]: https://wooorm.com\n\n[backers-badge]: https://opencollective.com/unified/backers/badge.svg\n\n[build]: https://github.com/micromark/micromark/actions\n\n[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg\n\n[bundle-size]: https://bundlejs.com/?q=micromark-factory-space\n\n[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-factory-space\n\n[chat]: https://github.com/micromark/micromark/discussions\n\n[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg\n\n[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md\n\n[contributing]: https://github.com/micromark/.github/blob/main/contributing.md\n\n[coverage]: https://codecov.io/github/micromark/micromark\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg\n\n[downloads]: https://www.npmjs.com/package/micromark-factory-space\n\n[downloads-badge]: https://img.shields.io/npm/dm/micromark-factory-space.svg\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[esmsh]: https://esm.sh\n\n[health]: https://github.com/micromark/.github\n\n[license]: https://github.com/micromark/micromark/blob/main/license\n\n[markdown-space]: https://github.com/micromark/micromark/tree/main/packages/micromark-util-character#markdownspacecode\n\n[micromark]: https://github.com/micromark/micromark\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[opencollective]: https://opencollective.com/unified\n\n[securitymd]: https://github.com/micromark/.github/blob/main/security.md\n\n[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg\n\n[support]: https://github.com/micromark/.github/blob/main/support.md\n\n[typescript]: https://www.typescriptlang.org\n\n## cjser\n\nThis package is a CommonJS-compatible build generated by cjser for projects that still need `require()` support. The source version matches the original npm package version, with a cjser prerelease suffix for this generated build.\nOriginal repository: https://github.com/micromark/micromark/tree/main/packages/micromark-factory-space\n","readmeFilename":"readme.md"}