{"name":"mdast-util-heading-style","version":"2.0.1","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/node":"^18.0.0","c8":"^7.0.0","mdast-util-from-markdown":"^1.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},"remarkConfig":{"plugins":["preset-wooorm"]},"typeCoverage":{"atLeast":100,"detail":true,"strict":true},"gitHead":"bfa756349fc608db32e1ae2fc8aa706b113332e2","homepage":"https://github.com/syntax-tree/mdast-util-heading-style#readme","_id":"mdast-util-heading-style@2.0.1","_nodeVersion":"19.3.0","_npmVersion":"9.2.0","dist":{"integrity":"sha512-0L5rthU4xKDVbw+UQ7D8Y8xOEsX4JXZvemWoEAsL+WAaeSH+TvVVwFnTb3G/OrjyP4VYQULoNWU+PdZfkmNu4A==","shasum":"078cb0120a06af777c60413f7ba10f6d071b4672","tarball":"http://registry-npm.ywwl.com/mdast-util-heading-style/download/mdast-util-heading-style-2.0.1.tgz","fileCount":7,"unpackedSize":11359,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGwzMZaxmQEOB13nwdeTWXhkngBnid7ITJ299iB5TIXTAiBoMSdqVGFvgbLyq+xe4CpKycN2FPHes+mC2/iO/DFw3Q=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj0QJkACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrVyhAAhVKoQaVYZQfO8+5P5lbWq2Ha8yhojs04LfbB1v9GMWAQevgb\r\n4p7ShlgwDDBg3JjuTC1uzOtNloI3yHimJFpxr5ewNx45SR3pUTxATd4Wfn3w\r\nyUpvhu92eIcfxoM70wdrMxF7xYMgAnjM13O4Kf3R48+bLMiaoI7CmtHGENpL\r\nhE9FbYA1MTLF/6ktAvNNhz5jCnXSUOhKtg41SWKCrrp8FDnohdqgcGz5tyOq\r\nInoBiLkTekHASW4kM5vNFLNZe7vaejLbSvkpQ0ardkwZyormqmZMycOdRiuA\r\n1A04nuM5jEsQn1Alx2U/bqg52UekTrAoT11hldd8UJVG+MltIP59ezDDK0ef\r\npKPeYheHmTL94gPanLyON5cXbmHHui3OcQMMtKjnZs0YJjVKQ+AU+SufsWoZ\r\nPgHX7RuyUlt77nTLPc7Sp4OeXutIYKthI735CPpZgfsXvtgtRzV65SmP2Ekw\r\nweQlVzSZkLLw4Yk7oALla3vF8NHdAh9WSkFTXZbtBhLecxWQaC0GZsFutaRj\r\nxpaJ6hgQpAxE2axMdcaaq4oO+FQ7Ojsk4alcKwIE0TzBDSm/mBKJYurKkWzf\r\nqbmcBomFcqBwfgCPYyXZKLduq3Sa+G6hz2w+XHenCF+4XPsXXfZJsIi8yTcd\r\npblDIPM1yXBbHVrbneOqluc5lBzLTzum0B4=\r\n=mWRz\r\n-----END PGP SIGNATURE-----\r\n","size":4195,"noattachment":false,"key":"/mdast-util-heading-style/-/mdast-util-heading-style-2.0.1.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.1_1674642019730_0.21003036069238257"},"_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":1674642019965,"_cnpm_publish_time":1674642019965,"dist-tags":{"latest":"3.0.0"}}