{"_id":"hast-util-truncate","_rev":"6-0e65f8e9cfb64d40e21de94d1447aef2","name":"hast-util-truncate","dist-tags":{"latest":"2.0.0"},"versions":{"1.0.0":{"name":"hast-util-truncate","version":"1.0.0","description":"hast utility to truncate the tree to a certain number of characters","license":"MIT","keywords":["unist","hast","hast-util","util","utility","html","truncate","excerpt","summary"],"repository":{"type":"git","url":"git+https://github.com/syntax-tree/hast-util-truncate.git"},"bugs":{"url":"https://github.com/syntax-tree/hast-util-truncate/issues"},"funding":{"type":"opencollective","url":"https://opencollective.com/unified"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"}],"sideEffects":false,"type":"module","main":"index.js","types":"index.d.ts","dependencies":{"@types/hast":"^2.0.0","micromark-util-character":"^1.0.0"},"devDependencies":{"@types/tape":"^4.0.0","c8":"^7.0.0","hast-util-select":"^5.0.0","hastscript":"^7.0.0","prettier":"^2.0.0","remark-cli":"^10.0.0","remark-preset-wooorm":"^9.0.0","rimraf":"^3.0.0","tape":"^5.0.0","type-coverage":"^2.0.0","typescript":"^4.0.0","xo":"^0.44.0"},"scripts":{"prepack":"npm run build && npm run format","build":"rimraf \"*.d.ts\" && tsc && type-coverage","format":"remark . -qfo && prettier . -w --loglevel warn && xo --fix","test-api":"node test.js","test-coverage":"c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node test.js","test":"npm run build && npm run format && npm run test-coverage"},"prettier":{"tabWidth":2,"useTabs":false,"singleQuote":true,"bracketSpacing":false,"semi":false,"trailingComma":"none"},"xo":{"prettier":true},"remarkConfig":{"plugins":["preset-wooorm"]},"typeCoverage":{"atLeast":100,"detail":true,"strict":true,"ignoreCatch":true},"gitHead":"70e0fce31ffa0975191140f90b30eae2801d7076","homepage":"https://github.com/syntax-tree/hast-util-truncate#readme","_id":"hast-util-truncate@1.0.0","_nodeVersion":"16.9.0","_npmVersion":"7.21.1","dist":{"integrity":"sha512-fVP0Pb66PN/5u1g9C4clXYhg+s59tnuRR2Sh2SPYqG6GByNHx3fDtxFIpBndZeHhqumCtV0XmS1t7WMz3vTEjA==","shasum":"81cc7a898676f827c30d83283c2661f5c716e71b","tarball":"https://registry.npmjs.org/hast-util-truncate/-/hast-util-truncate-1.0.0.tgz","fileCount":5,"unpackedSize":11710,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhOiozCRA9TVsSAnZWagAAaZUP/iw4eTCCgiI4bi2wrPdp\nzZOoL1TNekgCffTEeinGvy/SSJe6HkJe6xAEYdIqGKfm+PRcJB9Lrxm7PMDt\nIIVp5ET6C5Ru6su4SZNdAzoj3ReVidlWmsQTSJVES6O8KXSBx/BESgHekPJg\n2RHZf7cR6qolXVQG8Y8jSmFZG3VhCBICjCcWXhQMr1JPOTRmUYemqQfohWHv\nFAzFGV43Sgb4ZCksrMRy+Z5qhXQ2QRHrg4kexIQsinG33K3zL2+KTcV1USH/\nW0Ce9p0jmKJd8lyjM7rMtWe7RtGYEPh71WwWzXebilZXpWWxPbxDlgrOHwFp\n9Pjxn7MDych7LWd1nkl85bTk+l3TcO6nwk+sLV5olTdbHWd2oB50Pw86wthA\n9I61AyU6iIJEDqeQ2OSLTtAU+p7qbvZ8rds2rJ6JAvjD8nGYjkexbxMuafuQ\n/xGLDtN6JkTVUOGG4uR8gmEPO/HtfL38IM6rWbLoPVAryj439zKgWjoSF/2S\nGfB0shWakc4SprTpE7ltFCdrXKOu5M7QVpg5tE5xzz91m1/FkmupyLEZNE/F\nD27Qem/rAet0SSL7M3j9dGlaDRKnQNVdc7Kjq8DTcMMDaXz/uIGMLoHLQGtq\niTjee5q7AodzvjHGGNZGVle67ZtQPqes286tjQKY6A4YFGNhhDyCOoX2Sl0C\nbzLM\r\n=Q1cG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDuo0NJrK47c+8DCGGXIl3DB313idFTNe7qfabUVXlXcwIhAKNlumzqQUSkSkxMtaTt3zNmrk2sp9/xoEVs56Kg4S2R"}]},"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hast-util-truncate_1.0.0_1631201843212_0.5207044109648302"},"_hasShrinkwrap":false},"1.0.1":{"name":"hast-util-truncate","version":"1.0.1","description":"hast utility to truncate the tree to a certain number of characters","license":"MIT","keywords":["unist","hast","hast-util","util","utility","html","truncate","excerpt","summary"],"repository":{"type":"git","url":"git+https://github.com/syntax-tree/hast-util-truncate.git"},"bugs":{"url":"https://github.com/syntax-tree/hast-util-truncate/issues"},"funding":{"type":"opencollective","url":"https://opencollective.com/unified"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"}],"sideEffects":false,"type":"module","main":"index.js","types":"index.d.ts","dependencies":{"@types/hast":"^2.0.0","micromark-util-character":"^1.0.0"},"devDependencies":{"@types/tape":"^4.0.0","c8":"^7.0.0","hast-util-select":"^5.0.0","hastscript":"^7.0.0","prettier":"^2.0.0","remark-cli":"^10.0.0","remark-preset-wooorm":"^9.0.0","rimraf":"^3.0.0","tape":"^5.0.0","type-coverage":"^2.0.0","typescript":"^4.0.0","xo":"^0.44.0"},"scripts":{"prepack":"npm run build && npm run format","build":"rimraf \"*.d.ts\" && tsc && type-coverage","format":"remark . -qfo && prettier . -w --loglevel warn && xo --fix","test-api":"node test.js","test-coverage":"c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node test.js","test":"npm run build && npm run format && npm run test-coverage"},"prettier":{"tabWidth":2,"useTabs":false,"singleQuote":true,"bracketSpacing":false,"semi":false,"trailingComma":"none"},"xo":{"prettier":true},"remarkConfig":{"plugins":["preset-wooorm"]},"typeCoverage":{"atLeast":100,"detail":true,"strict":true,"ignoreCatch":true},"gitHead":"1e7abbcc9b2539db4e30c2890a9fa554ffcc194d","homepage":"https://github.com/syntax-tree/hast-util-truncate#readme","_id":"hast-util-truncate@1.0.1","_nodeVersion":"16.9.0","_npmVersion":"7.21.1","dist":{"integrity":"sha512-7xT0sShgZiDhSn8K/ZTvpUUOdBqZ8ZnyW35pIzFyT9c+3WxDdDr9oMRwwyMZrA5sTdm/Cv/OnPPiMp1Uu+Bf+g==","shasum":"38e3566c9de95d840c939fdd5dfcec3e93f17811","tarball":"https://registry.npmjs.org/hast-util-truncate/-/hast-util-truncate-1.0.1.tgz","fileCount":5,"unpackedSize":13580,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhOixGCRA9TVsSAnZWagAAKEYP/1ce43Cxz6QthxKI5LK0\nZBd3WMnlJ4wjiz+Fckuu1Ik1iMmU2K+/8BG2JzUkFkX9BOeLjKcv/43jDGP5\ndnpxHFae0990+89Z7Baxi01/xnjdLMdWOi3oH7W2gxACDUHt+KX9UtRwr7ou\ncTq9mCvEuoxsKZfSpy8jXFkf/YwHpe/N+oJUrJjlvoBhLSVdYK+klZ5dLcEQ\nLvPGH2i6yzpE4Z40Uvn57Nlukrw0Mq6qTsi/6W6DLM69fNpAO8X15XEcRNb6\nrh0vhZhc01npvGL3V7OlvdC3U6AuocJM+X4RoTSErCUWVN0K6g2GEOirJ2PF\nX3+P7iYSU7BZQpNWfMF6A/zy/RigChQc4RjTS+H0uzQqW4Gx7gPMwD52+TM6\nLmzVpzx64vUqvN7WGgQkNlrtxXhXNZSPa7GjEZxpIz1Vzhs42oQ5lX8Gz54Y\nEoH4PdfO9WvHe2Qu8i6kJGrl+wKZkYRHKxqpUkgMXp8yHvVSs9AH+BE7IRy/\nf5eSB/nylefGtqsbFiaLUUS5X0oN/zExikvQGrmDiObPXx0FxQNfDk1/WMPe\nlTo0/UUWg3QNJEd7xbeMUQ9F9wSoDrKnV/ouiESDgJazDrZIx7HkFznj+WcV\nwqLNMswdKv6lhhfU0ztL5c7PcOKGmf3AuKVSyEqV3Qo20SIw2gjMaEfeMjwn\nK9vt\r\n=jxNH\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD7sZRMlSZTNptvYlS52kSEzxCbhzGfCXuzwsWESmDDdwIhAJjR2N3oRiLvP/trJeI54J6+bMe23IsWX3pzJJqL6XGx"}]},"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hast-util-truncate_1.0.1_1631202374686_0.6105733551186885"},"_hasShrinkwrap":false},"1.0.2":{"name":"hast-util-truncate","version":"1.0.2","description":"hast utility to truncate the tree to a certain number of characters","license":"MIT","keywords":["unist","hast","hast-util","util","utility","html","truncate","excerpt","summary"],"repository":{"type":"git","url":"git+https://github.com/syntax-tree/hast-util-truncate.git"},"bugs":{"url":"https://github.com/syntax-tree/hast-util-truncate/issues"},"funding":{"type":"opencollective","url":"https://opencollective.com/unified"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"}],"sideEffects":false,"type":"module","main":"index.js","types":"index.d.ts","dependencies":{"@types/hast":"^2.0.0","micromark-util-character":"^1.0.0"},"devDependencies":{"@types/node":"^18.0.0","c8":"^7.0.0","hast-util-select":"^5.0.0","hastscript":"^7.0.0","prettier":"^2.0.0","remark-cli":"^11.0.0","remark-preset-wooorm":"^9.0.0","type-coverage":"^2.0.0","typescript":"^4.0.0","xo":"^0.53.0"},"scripts":{"prepack":"npm run build && npm run format","build":"tsc --build --clean && tsc --build && type-coverage","format":"remark . -qfo && prettier . -w --loglevel warn && xo --fix","test-api":"node --conditions development test.js","test-coverage":"c8 --check-coverage --100 --reporter lcov npm run test-api","test":"npm run build && npm run format && npm run test-coverage"},"prettier":{"tabWidth":2,"useTabs":false,"singleQuote":true,"bracketSpacing":false,"semi":false,"trailingComma":"none"},"xo":{"prettier":true,"rules":{"unicorn/prefer-code-point":"off"}},"remarkConfig":{"plugins":["preset-wooorm"]},"typeCoverage":{"atLeast":100,"detail":true,"strict":true,"ignoreCatch":true},"gitHead":"a4be176bb6b7dcb3985c13632703dc010bae40fa","homepage":"https://github.com/syntax-tree/hast-util-truncate#readme","_id":"hast-util-truncate@1.0.2","_nodeVersion":"19.3.0","_npmVersion":"9.2.0","dist":{"integrity":"sha512-IWLuKZGZ9YaA4mmxlYyQgxbYARRRjomRaPnwvgwhC6VfUD9uAhdDa6+B0ad23rOoC4RyLVMB8fIE40x/O6qK1Q==","shasum":"642cff8b051c07c7a0bc3094a608a3624a3c1ec0","tarball":"https://registry.npmjs.org/hast-util-truncate/-/hast-util-truncate-1.0.2.tgz","fileCount":7,"unpackedSize":17477,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDU0Jr72NvDKct03cWFMM7WhcYkrhYRoFQCOLN5sSk4XQIgLhuClox4wKSMgLNzOig0/Bqg6NB6GmGrEMI+60+H5UM="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtqzHACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrWUxAAmp2kUaP5O8BUCgG44M1vi27UvCAW+C4pQG+I9p69nVgfUVwW\r\nX22TpuWlPjCLvfRcnp7kcwPhNGMScpWf3DqUd7DPECP5/6pe+QZanbvmd1P2\r\nMacE3Kjuo6kosAtJE/snEKl450XbeGolzo6qsFgNdl7T4ZL9imt91sVtnkGv\r\n3ssUBJlgdLHVzyZ0Hz/dBZjUXgeKKDje2y7NKbJnbV/KWWxG3/ro7EphIUF2\r\nt5BMKnCM+FzhXkA5MTa068+XrQuvOIaKg97sBe7XnwmzuKSx86D705bdsNgH\r\nZ9/RzxeZ3c3klgg/swFqw/PUZJxVBkPePI/TuvY7W1C5mT5KgmKYIamTgTLe\r\ny5Ricp6wxHATObe3jsik3pHoh89C2VENhvwPoh/ucXJUG1Glso2q5eIDr0gk\r\nj5Y8ueBa4nNivb9kR4YNz7Aa0JuXqK08VyLBHb4JnAVRBUxJhZ+efAbn+yeo\r\n71UwQhlUw46/CC1zY5KwZZ23Jg7hQ5PscXFxU2Ke0SONML0nIhL2lxyTEyYs\r\n0/f9Q7PTtLynwC4oBqGivoiVpFLw7loEj7M3IuAirBOHWh6ApDEivZ/2yd8a\r\nOvchk0iq1K0U+RnmFjb+NacPF52CdNcFQ0xpFLgQwih6Nm8DNSVff6KSeW8v\r\nVSWt1PbwKCNjpHoYpui3u5ZScUwhEzctdWo=\r\n=wbpD\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"},{"name":"kmck","email":"keith@mcknig.ht"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hast-util-truncate_1.0.2_1672916167746_0.7072395197597909"},"_hasShrinkwrap":false},"2.0.0":{"name":"hast-util-truncate","version":"2.0.0","description":"hast utility to truncate the tree to a certain number of characters","license":"MIT","keywords":["unist","hast","hast-util","util","utility","html","truncate","excerpt","summary"],"repository":{"type":"git","url":"git+https://github.com/syntax-tree/hast-util-truncate.git"},"bugs":{"url":"https://github.com/syntax-tree/hast-util-truncate/issues"},"funding":{"type":"opencollective","url":"https://opencollective.com/unified"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"}],"sideEffects":false,"type":"module","exports":"./index.js","dependencies":{"@types/hast":"^3.0.0","@ungap/structured-clone":"^1.0.0","micromark-util-character":"^2.0.0"},"devDependencies":{"@types/node":"^20.0.0","@types/ungap__structured-clone":"^0.3.0","c8":"^8.0.0","hast-util-select":"^6.0.0","hastscript":"^8.0.0","prettier":"^3.0.0","remark-cli":"^11.0.0","remark-preset-wooorm":"^9.0.0","type-coverage":"^2.0.0","typescript":"^5.0.0","xo":"^0.55.0"},"scripts":{"prepack":"npm run build && npm run format","build":"tsc --build --clean && tsc --build && type-coverage","format":"remark . -qfo && prettier . -w --log-level warn && xo --fix","test-api":"node --conditions development test.js","test-coverage":"c8 --100 --reporter lcov npm run test-api","test":"npm run build && npm run format && npm run test-coverage"},"prettier":{"bracketSpacing":false,"semi":false,"singleQuote":true,"tabWidth":2,"trailingComma":"none","useTabs":false},"remarkConfig":{"plugins":["remark-preset-wooorm"]},"typeCoverage":{"atLeast":100,"detail":true,"ignoreCatch":true,"strict":true},"xo":{"prettier":true,"rules":{"unicorn/prefer-code-point":"off"}},"gitHead":"c1d4e2a82b52225f738319f9a187962ab9fb3194","types":"./index.d.ts","homepage":"https://github.com/syntax-tree/hast-util-truncate#readme","_id":"hast-util-truncate@2.0.0","_nodeVersion":"20.0.0","_npmVersion":"9.7.2","dist":{"integrity":"sha512-QjtUhkt0hT75dHwwTYS+E9Rge12IVClGUErJgss7q7EewBuSr6LoGjq7nPp3R6BThqWJ6CbarPVPCbklwnUf/g==","shasum":"1becac58e223eeec5efe16d61e9d3f68c09b80de","tarball":"https://registry.npmjs.org/hast-util-truncate/-/hast-util-truncate-2.0.0.tgz","fileCount":7,"unpackedSize":17872,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDLYBvSwa0F4knamA7tByrJWev035Symc2YgijcrjPUgQIgLlWFy57G8GoOo+wkdscWbPMibOBYcPh3yTH9JmetunQ="}]},"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"},{"name":"kmck","email":"keith@mcknig.ht"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hast-util-truncate_2.0.0_1691429935903_0.6026658388697963"},"_hasShrinkwrap":false}},"time":{"created":"2021-09-09T15:37:23.211Z","1.0.0":"2021-09-09T15:37:23.373Z","modified":"2023-08-07T17:38:56.201Z","1.0.1":"2021-09-09T15:46:14.822Z","1.0.2":"2023-01-05T10:56:07.855Z","2.0.0":"2023-08-07T17:38:56.051Z"},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"},{"name":"kmck","email":"keith@mcknig.ht"}],"description":"hast utility to truncate the tree to a certain number of characters","homepage":"https://github.com/syntax-tree/hast-util-truncate#readme","keywords":["unist","hast","hast-util","util","utility","html","truncate","excerpt","summary"],"repository":{"type":"git","url":"git+https://github.com/syntax-tree/hast-util-truncate.git"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"}],"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},"bugs":{"url":"https://github.com/syntax-tree/hast-util-truncate/issues"},"license":"MIT","readme":"# hast-util-truncate\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n[![Sponsors][sponsors-badge]][collective]\n[![Backers][backers-badge]][collective]\n[![Chat][chat-badge]][chat]\n\n[hast][] utility to truncate the tree to a certain number of characters.\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    *   [`truncate(tree[, options])`](#truncatetree-options)\n    *   [`Options`](#options)\n*   [Types](#types)\n*   [Compatibility](#compatibility)\n*   [Security](#security)\n*   [Related](#related)\n*   [Contribute](#contribute)\n*   [License](#license)\n\n## What is this?\n\nThis package is a utility that takes a [hast][] (HTML) syntax tree and truncates\nit to a certain number of characters, while otherwise preserving the tree\nstructure.\n\n## When should I use this?\n\nThis is a small utility useful when you need to create a shorter version of a\npotentially long document.\n\nThis utility is similar to [`hast-util-excerpt`][hast-util-excerpt], which\ntruncates a tree to a certain comment.\n\nThe rehype plugin\n[`rehype-infer-description-meta`][rehype-infer-description-meta]\nwraps both this utility and `hast-util-excerpt` to figure out a description of a\ndocument, for use with [`rehype-meta`][rehype-meta].\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install hast-util-truncate\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport {truncate} from 'https://esm.sh/hast-util-truncate@2'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n<script type=\"module\">\n  import {truncate} from 'https://esm.sh/hast-util-truncate@2?bundle'\n</script>\n```\n\n## Use\n\nSay our module `example.js` looks as follows:\n\n```js\nimport {h} from 'hastscript'\nimport {truncate} from 'hast-util-truncate'\n\nconst tree = h('p', [\n  'Lorem ipsum dolor sit amet, ',\n  h('em', 'consectetur'),\n  'adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud'\n])\n\nconsole.log(truncate(tree, {ellipsis: '…'}));\n```\n\n…now running `node example.js` yields:\n\n```js\n{\n  type: 'element',\n  tagName: 'p',\n  properties: {},\n  children: [\n    {type: 'text', value: 'Lorem ipsum dolor sit amet, '},\n    {\n      type: 'element',\n      tagName: 'em',\n      properties: {},\n      children: [{type: 'text', value: 'consectetur'}]\n    },\n    {\n      type: 'text',\n      value: 'adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim…'\n    }\n  ]\n}\n```\n\n## API\n\nThis package exports the identifier [`truncate`][api-truncate].\nThere is no default export.\n\n### `truncate(tree[, options])`\n\nTruncate the tree to a certain number of characters.\n\n###### Parameters\n\n*   `tree` ([`Node`][node])\n    — tree to truncate\n*   `options` ([`Options`][api-options], optional)\n    — configuration\n\n###### Returns\n\nTruncated copy of `tree` ([`Node`][node]).\n\n### `Options`\n\nConfiguration (TypeScript type).\n\n##### Fields\n\n###### `options.size`\n\nNumber of characters to truncate to (`number`, default: `140`).\n\n###### `options.ellipsis`\n\nValue to use at truncation point (`string`, optional).\n\n###### `options.maxCharacterStrip`\n\nHow far to walk back (`number`, default: `30`).\nThe algorithm attempts to break right after a word rather than the exact `size`.\nTake for example the `|`, which is the actual break defined by `size`, and the\n`…` is the location where the ellipsis is placed: `This… an|d that`.\nBreaking at `|` would at best look bad but could likely result in things such as\n`ass…` for `assignment`, which is not ideal.\n`maxCharacterStrip` defines how far back the algorithm will walk to find a\npretty word break.\nThis prevents a potential slow operation on larger `size`s without any\nwhitespace.\nIf `maxCharacterStrip` characters are walked back and no nice break point is\nfound, the bad break point is used.\nSet `maxCharacterStrip: 0` to not find a nice break.\n\n###### `options.ignore`\n\nNodes to exclude from the resulting tree (`Array<Node>`).\nThese are not counted towards `size`.\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports the additional type [`Options`][api-options].\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, `hast-util-truncate@^2`,\ncompatible with Node.js 16.\n\n## Security\n\nUse of `hast-util-truncate` should be safe if the tree is already safe and\nyou’re not using user content in options.\nWhen in doubt, use [`hast-util-sanitize`][hast-util-sanitize].\n\n## Related\n\n*   [`hast-util-excerpt`][hast-util-excerpt]\n    — truncate the tree to a comment\n*   [`rehype-infer-description-meta`][rehype-infer-description-meta]\n    — infer file metadata from the contents of the document\n*   [`rehype-meta`][rehype-meta]\n    — add metadata to the head of a document\n\n## Contribute\n\nSee [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for\nways to 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, organization, or community you agree to\nabide by its terms.\n\n## License\n\n[MIT][license] © [Titus Wormer][author]\n\n<!-- Definitions -->\n\n[build-badge]: https://github.com/syntax-tree/hast-util-truncate/workflows/main/badge.svg\n\n[build]: https://github.com/syntax-tree/hast-util-truncate/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/hast-util-truncate.svg\n\n[coverage]: https://codecov.io/github/syntax-tree/hast-util-truncate\n\n[downloads-badge]: https://img.shields.io/npm/dm/hast-util-truncate.svg\n\n[downloads]: https://www.npmjs.com/package/hast-util-truncate\n\n[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=hast-util-truncate\n\n[size]: https://bundlejs.com/?q=hast-util-truncate\n\n[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg\n\n[backers-badge]: https://opencollective.com/unified/backers/badge.svg\n\n[collective]: https://opencollective.com/unified\n\n[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg\n\n[chat]: https://github.com/syntax-tree/unist/discussions\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[esmsh]: https://esm.sh\n\n[typescript]: https://www.typescriptlang.org\n\n[license]: license\n\n[author]: https://wooorm.com\n\n[health]: https://github.com/syntax-tree/.github\n\n[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md\n\n[support]: https://github.com/syntax-tree/.github/blob/main/support.md\n\n[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md\n\n[hast]: https://github.com/syntax-tree/hast\n\n[node]: https://github.com/syntax-tree/hast#nodes\n\n[hast-util-sanitize]: https://github.com/syntax-tree/hast-util-sanitize\n\n[hast-util-excerpt]: https://github.com/syntax-tree/hast-util-excerpt\n\n[rehype-infer-description-meta]: https://github.com/rehypejs/rehype-infer-description-meta\n\n[rehype-meta]: https://github.com/rehypejs/rehype-meta\n\n[api-truncate]: #truncatetree-options\n\n[api-options]: #options\n","readmeFilename":"readme.md","users":{"flumpus-dev":true}}