{"name":"mdast-util-heading-style","version":"0.1.0","description":"Utility to get the style of a heading","license":"MIT","keywords":["mdast","markdown","node","heading","style","util","utility"],"repository":{"type":"git","url":"git+https://github.com/wooorm/mdast-util-heading-style.git"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com"},"files":["index.js","LICENSE"],"devDependencies":{"browserify":"^10.0.0","eslint":"^0.24.0","esmangle":"^1.0.0","istanbul":"^0.3.0","jscs":"^1.0.0","jscs-jsdoc":"^1.0.0","mdast":"^0.26.0","mdast-github":"^0.3.0","mdast-lint":"^0.4.0","mdast-yaml-config":"^0.2.0","mocha":"^2.0.0"},"scripts":{"test-api":"mocha --check-leaks test.js","test-coveralls":"istanbul cover _mocha --report lcovonly -- --check-leaks test.js","test-coverage":"istanbul cover _mocha -- test.js","test-travis":"npm run test-coveralls","test":"npm run test-api","lint-api":"eslint .","lint-style":"jscs --reporter inline .","lint":"npm run lint-api && npm run lint-style","make":"npm run lint && npm run test-coverage","bundle":"browserify index.js --no-builtins -s mdastUtilHeadingStyle > mdast-util-heading-style.js","postbundle":"esmangle mdast-util-heading-style.js > mdast-util-heading-style.min.js","build-md":"mdast . --output --quiet","build":"npm run bundle && npm run build-md"},"gitHead":"24fbf051cc434214dbf93af7762d9d08e2c55d89","bugs":{"url":"https://github.com/wooorm/mdast-util-heading-style/issues"},"homepage":"https://github.com/wooorm/mdast-util-heading-style#readme","_id":"mdast-util-heading-style@0.1.0","_shasum":"cd54d34a299be593dff4f76053ebd04adbff46cd","_from":".","_npmVersion":"2.11.1","_nodeVersion":"2.3.0","_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"}],"dist":{"shasum":"cd54d34a299be593dff4f76053ebd04adbff46cd","tarball":"http://registry-npm.ywwl.com/mdast-util-heading-style/download/mdast-util-heading-style-0.1.0.tgz","integrity":"sha512-/7hGOWCYBptpQVdGDKEzOmr7nafzQN3rTokd5+PqCAT9zMykJPrM4xZfNuhOw5qF0w2wip/SQ2U4PlQu7M3YHQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAMkOTumLKcEXXaNoPPcOGg0OZO8eziep9iCivQSVPHIAiA+zWR5HuFMDsdrjLwNyBhEK5HP3WfoQBNukt43VsDqUg=="}],"size":2925,"noattachment":false,"key":"/mdast-util-heading-style/-/mdast-util-heading-style-0.1.0.tgz"},"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":1436010987630,"_cnpm_publish_time":1436010987630,"dist-tags":{"latest":"3.0.0"}}