{"name":"mdast-util-heading-style","version":"2.0.0","description":"mdast utility to get the style of a heading","license":"MIT","keywords":["unist","mdast","mdast-util","util","utility","markdown","node","heading","style"],"repository":{"type":"git","url":"git+https://github.com/syntax-tree/mdast-util-heading-style.git"},"bugs":{"url":"https://github.com/syntax-tree/mdast-util-heading-style/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/mdast":"^3.0.0"},"devDependencies":{"@types/tape":"^4.0.0","c8":"^7.0.0","prettier":"^2.0.0","remark":"^13.0.0","remark-cli":"^9.0.0","remark-preset-wooorm":"^8.0.0","rimraf":"^3.0.0","tape":"^5.0.0","type-coverage":"^2.0.0","typescript":"^4.0.0","xo":"^0.39.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,"rules":{"no-var":"off","prefer-arrow-callback":"off"}},"remarkConfig":{"plugins":["preset-wooorm"]},"typeCoverage":{"atLeast":100,"detail":true,"strict":true},"gitHead":"8f6a284134e6b6be26cd3d5a3c64567876d76107","homepage":"https://github.com/syntax-tree/mdast-util-heading-style#readme","_id":"mdast-util-heading-style@2.0.0","_nodeVersion":"15.11.0","_npmVersion":"7.10.0","dist":{"integrity":"sha512-q9+WW2hJduW51LgV2r/fcU5wIt2GLFf0yYHxyi0f2aaxnC63ErBSOAJlhP6nbQ6yeG5rTCozbwOi4QNDPKV0zw==","shasum":"19bcc14d96b4a6f24efbe1318409bd34af64bb7f","tarball":"http://registry-npm.ywwl.com/mdast-util-heading-style/download/mdast-util-heading-style-2.0.0.tgz","fileCount":5,"unpackedSize":8778,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgg9AFCRA9TVsSAnZWagAAwMYP/0lTuN2z35ilAtx+tH0d\nbeHrkUnFcQTRNrbcpvUyemMXonlSzU1pXXsYZU7v34FIn1WgAdKPah+OX7ZZ\nt2CBrI+jSlOQpiotkVVjGh/2vP2EaMFL8KvjbZF4OJhanQvaEMGD1IfN7AWH\n/GECxnXcC31bfkIv/DBh8ggCrhIDWUV9vjGIgRC4xS1PWJlLLGoGfeqXogOZ\n3vQgaOsFJA7UuhDelNWDPVhAf3eTqZrLUTDOJecUgM1pAbLeGEyUDEgtCKXy\nqhKA/P/rLbAWaRvUSvoy+R2ycwCzgRGD9pLqf1mmjvP7Y9izusdJbBmto4cy\ncir/v0Ec+UYlm3zbC7Q1FENYyxrROrZn7zt5r112VgR9osdWOkpeb78WVRst\ns082iQ+GCePtMg7GjtZiFv7c9bvNKhJt3pTzDNuc/d65RQE2OxxzbSVq+ljn\nz9aNDBDHp7Grhtq1Ma+FWMZZEFzSHqbX4vD8OoZKY/6kaOUWyEy0nvYKmHJX\nw/4FOKprhdzToWnXkKak86rmeLvXz49C6Bzi0CRRPfZTUp9MfoDd5bM9npdG\no4Do6/KZl/++MwP1/txyQPG4f7cSfq/i97V0zcIsUUA+ktZ5Ixo7q/tBDTHT\nMEZ5rx6bn2s21Jln94NtdV9dF8dDsad01l2l3CJB8T2NGHlRHrFe+K6Vm0Pb\nZhZ7\r\n=zSYk\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCV0c+G972L1L2ucc9hovWzSidskkVoaOKcWiQedpiCpQIgMOrJzYxN3YUT5s6XVyuSvxZmRrMCeSNCCeiOCGFBq74="}],"size":3543,"noattachment":false,"key":"/mdast-util-heading-style/-/mdast-util-heading-style-2.0.0.tgz"},"_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/mdast-util-heading-style_2.0.0_1619251205302_0.23573517166169644"},"_hasShrinkwrap":false,"readme":"# mdast-util-heading-style\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[mdast][] utility to get the style of a heading.\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    *   [`headingStyle(node[, relative])`](#headingstylenode-relative)\n    *   [`Style`](#style)\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 tiny utility to figure out if a heading was written as ATX or\nas setext.\n\n```markdown\n## ATX uses hashes\n\nSetext uses an underline\n------------------------\n```\n\n## When should I use this?\n\nProbably not a lot!\nIt’s used in [`remark-lint`][remark-lint].\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install mdast-util-heading-style\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport {headingStyle} from 'https://esm.sh/mdast-util-heading-style@3'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n<script type=\"module\">\n  import {headingStyle} from 'https://esm.sh/mdast-util-heading-style@3?bundle'\n</script>\n```\n\n## Use\n\n```js\nimport {unified} from 'unified'\nimport {fromMarkdown} from 'mdast-util-from-markdown'\nimport {headingStyle} from 'mdast-util-heading-style'\n\nheadingStyle(fromMarkdown('# ATX').children[0]) // => 'atx'\nheadingStyle(fromMarkdown('# ATX #\\n').children[0]) // => 'atx-closed'\nheadingStyle(fromMarkdown('ATX\\n===').children[0]) // => 'setext'\n\nheadingStyle(fromMarkdown('### ATX').children[0]) // => undefined\nheadingStyle(fromMarkdown('### ATX').children[0], 'setext') // => 'setext'\n```\n\n## API\n\nThis package exports the identifier [`headingStyle`][api-headingstyle].\nThere is no default export.\n\n### `headingStyle(node[, relative])`\n\nGet the heading style of a heading, optionally `relative` to a preferred\nstyle.\n\nThis is because ATX headings with a depth of three or more could be\nconsidered setext.\n\n###### Parameters\n\n*   `node` ([`Heading`][heading])\n    — heading node to check\n*   `style` ([`Style`][api-style], optional)\n    — relative style\n\n###### Returns\n\nStyle ([`Style`][api-style]) if it can be inferred, `undefined` otherwise.\n\n### `Style`\n\nStyle of heading (TypeScript type).\n\n###### Type\n\n```ts\ntype Style = 'atx' | 'atx-closed' | 'setext'\n```\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports the additional type [`Style`][api-style].\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`mdast-util-heading-style@^3`, compatible with Node.js 16.\n\n## Security\n\nUse of `mdast-util-heading-style` does not involve **[hast][]** so there are\nno openings for [cross-site scripting (XSS)][xss] attacks.\n\n## Related\n\n*   [`mdast-normalize-headings`](https://github.com/syntax-tree/mdast-normalize-headings)\n    — make sure there is no more than a single top-level heading\n*   [`mdast-util-heading-range`](https://github.com/syntax-tree/mdast-util-heading-range)\n    — use headings as ranges\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/mdast-util-heading-style/workflows/main/badge.svg\n\n[build]: https://github.com/syntax-tree/mdast-util-heading-style/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-heading-style.svg\n\n[coverage]: https://codecov.io/github/syntax-tree/mdast-util-heading-style\n\n[downloads-badge]: https://img.shields.io/npm/dm/mdast-util-heading-style.svg\n\n[downloads]: https://www.npmjs.com/package/mdast-util-heading-style\n\n[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=mdast-util-heading-style\n\n[size]: https://bundlejs.com/?q=mdast-util-heading-style\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[license]: license\n\n[author]: https://wooorm.com\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[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[mdast]: https://github.com/syntax-tree/mdast\n\n[heading]: https://github.com/syntax-tree/mdast#heading\n\n[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting\n\n[hast]: https://github.com/syntax-tree/hast\n\n[remark-lint]: https://github.com/remarkjs/remark-lint\n\n[api-headingstyle]: #headingstylenode-relative\n\n[api-style]: #style\n","publish_time":1619251205527,"_cnpm_publish_time":1619251205527,"dist-tags":{"latest":"3.0.0"}}