{"name":"mdast-util-heading-style","version":"1.0.3","description":"Utility to get the style of an mdast heading","license":"MIT","keywords":["mdast","markdown","node","heading","style","util","utility"],"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"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"http://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"http://wooorm.com"}],"files":["index.js"],"dependencies":{},"devDependencies":{"browserify":"^14.0.0","esmangle":"^1.0.0","nyc":"^11.0.0","remark":"^7.0.0","remark-cli":"^3.0.0","remark-preset-wooorm":"^3.0.0","tape":"^4.4.0","xo":"^0.18.0"},"scripts":{"build-md":"remark . --quiet --frail --output","build-bundle":"browserify index.js --no-builtins -s mdastUtilHeadingStyle > mdast-util-heading-style.js","build-mangle":"esmangle mdast-util-heading-style.js > mdast-util-heading-style.min.js","build":"npm run build-md && npm run build-bundle && npm run build-mangle","lint":"xo","test-api":"node test.js","test-coverage":"nyc --reporter lcov tape test.js","test":"npm run build && npm run lint && npm run test-coverage"},"xo":{"space":true,"esnext":false,"ignore":["mdast-util-heading-style.js"]},"nyc":{"check-coverage":true,"lines":100,"functions":100,"branches":100},"remarkConfig":{"plugins":["preset-wooorm"]},"gitHead":"26d602069e68486ecd44e0b24cbc2c22356586c6","homepage":"https://github.com/syntax-tree/mdast-util-heading-style#readme","_id":"mdast-util-heading-style@1.0.3","_shasum":"efb390dbc8aa016c3cf577a034900db27ee7247c","_from":".","_npmVersion":"2.14.2","_nodeVersion":"4.0.0","_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"dist":{"shasum":"efb390dbc8aa016c3cf577a034900db27ee7247c","tarball":"http://registry-npm.ywwl.com/mdast-util-heading-style/download/mdast-util-heading-style-1.0.3.tgz","integrity":"sha512-0I9V8I08JCVUPtc2eT2d5J8/jICD46ZBWwC65m2eJGw6Gva0KsQELeiGuX+vQIltyZNBrIGZD2mgaPVdJed8NA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD7LPltoUHef90IEDnqoZn9uVg9gmFit/iSTBmotybZzAIhAISBCt/GqKtCId58AEr4iBkeU/O4xba5C/XwxU6EHsLn"}],"size":2559,"noattachment":false,"key":"/mdast-util-heading-style/-/mdast-util-heading-style-1.0.3.tgz"},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mdast-util-heading-style-1.0.3.tgz_1497373905834_0.23573453514836729"},"directories":{},"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":1497373908167,"_cnpm_publish_time":1497373908167,"dist-tags":{"latest":"3.0.0"}}