{"id":13339505,"url":"https://github.com/syntax-tree/hast-util-heading","last_synced_at":"2025-07-30T08:15:56.667Z","repository":{"id":7464488,"uuid":"56449614","full_name":"syntax-tree/hast-util-heading","owner":"syntax-tree","description":"utility to check if a node is heading content","archived":false,"fork":false,"pushed_at":"2023-08-01T11:04:25.000Z","size":93,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-05-13T19:03:26.587Z","etag":null,"topics":["hast","hast-util","heading","html","unist","util"],"latest_commit_sha":null,"homepage":"https://unifiedjs.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/syntax-tree.png","metadata":{"funding":{"github":"unifiedjs","open_collective":"unified"},"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-04-17T17:37:06.000Z","updated_at":"2024-04-28T08:46:58.000Z","dependencies_parsed_at":"2024-06-18T22:54:23.187Z","dependency_job_id":"f2fc74e3-db12-44fe-9e70-0c07745c8603","html_url":"https://github.com/syntax-tree/hast-util-heading","commit_stats":{"total_commits":85,"total_committers":3,"mean_commits":"28.333333333333332","dds":0.02352941176470591,"last_synced_commit":"1967314fc2bac9f1697553cfac00162a3fe5d2e4"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/syntax-tree/hast-util-heading","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntax-tree%2Fhast-util-heading","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntax-tree%2Fhast-util-heading/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntax-tree%2Fhast-util-heading/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntax-tree%2Fhast-util-heading/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/syntax-tree","download_url":"https://codeload.github.com/syntax-tree/hast-util-heading/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntax-tree%2Fhast-util-heading/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267820274,"owners_count":24149282,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hast","hast-util","heading","html","unist","util"],"created_at":"2024-07-29T19:20:04.305Z","updated_at":"2025-07-30T08:15:56.641Z","avatar_url":"https://github.com/syntax-tree.png","language":"JavaScript","readme":"# hast-util-heading\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 check if a node is a [*heading content* element][spec].\n\n## Contents\n\n*   [When should I use this?](#when-should-i-use-this)\n*   [Install](#install)\n*   [Use](#use)\n*   [API](#api)\n    *   [`heading(value)`](#headingvalue)\n*   [Types](#types)\n*   [Compatibility](#compatibility)\n*   [Security](#security)\n*   [Related](#related)\n*   [Contribute](#contribute)\n*   [License](#license)\n\n## When should I use this?\n\nThis utility is super niche, if you’re here you probably know what you’re\nlooking for!\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-heading\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport {heading} from 'https://esm.sh/hast-util-heading@3'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n\u003cscript type=\"module\"\u003e\n  import {heading} from 'https://esm.sh/hast-util-heading@3?bundle'\n\u003c/script\u003e\n```\n\n## Use\n\n```js\nimport {heading} from 'hast-util-heading'\n\n// Given a non-heading value:\nheading({\n  type: 'element',\n  tagName: 'a',\n  properties: {href: '#alpha', title: 'Bravo'},\n  children: [{type: 'text', value: 'Charlie'}]\n}) // =\u003e false\n\n// Given a heading element:\nheading({\n  type: 'element',\n  tagName: 'h1',\n  properties: {},\n  children: [{type: 'text', value: 'Delta'}]\n}) // =\u003e true\n```\n\n## API\n\nThis package exports the identifier [`heading`][api-heading].\nThere is no default export.\n\n### `heading(value)`\n\nCheck if the given value is a [*heading content* element][spec].\n\n###### Parameters\n\n*   `value` (`unknown`)\n    — thing to check (typically [`Node`][node])\n\n###### Returns\n\nWhether value is a heading content element (`boolean`).\n\nThe elements `h1`, `h2`, `h3`, `h4`, `h5`, `h6`, and `hgroup` are heading\ncontent.\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports no additional types.\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-heading@^3`,\ncompatible with Node.js 16.\n\n## Security\n\n`hast-util-heading` does not change the syntax tree so there are no openings for\n[cross-site scripting (XSS)][xss] attacks.\n\n## Related\n\n*   [`hast-util-heading-rank`](https://github.com/syntax-tree/hast-util-heading-rank)\n    — get the rank (or depth, level) of headings\n*   [`hast-util-shift-heading`](https://github.com/syntax-tree/hast-util-shift-heading)\n    — change the rank (or depth, level) of headings\n*   [`hast-util-is-element`](https://github.com/syntax-tree/hast-util-is-element)\n    — check if a node is a (certain) element\n*   [`hast-util-has-property`](https://github.com/syntax-tree/hast-util-has-property)\n    — check if a node has a property\n*   [`hast-util-is-body-ok-link`](https://github.com/rehypejs/rehype-minify/tree/main/packages/hast-util-is-body-ok-link)\n    — check if a node is “Body OK” link element\n*   [`hast-util-is-conditional-comment`](https://github.com/rehypejs/rehype-minify/tree/main/packages/hast-util-is-conditional-comment)\n    — check if a node is a conditional comment\n*   [`hast-util-is-css-link`](https://github.com/rehypejs/rehype-minify/tree/main/packages/hast-util-is-css-link)\n    — check if a node is a CSS link element\n*   [`hast-util-is-css-style`](https://github.com/rehypejs/rehype-minify/tree/main/packages/hast-util-is-css-style)\n    — check if a node is a CSS style element\n*   [`hast-util-embedded`](https://github.com/syntax-tree/hast-util-embedded)\n    — check if a node is an embedded element\n*   [`hast-util-interactive`](https://github.com/syntax-tree/hast-util-interactive)\n    — check if a node is interactive\n*   [`hast-util-is-javascript`](https://github.com/rehypejs/rehype-minify/tree/main/packages/hast-util-is-javascript)\n    — check if a node is a JavaScript script element\n*   [`hast-util-labelable`](https://github.com/syntax-tree/hast-util-labelable)\n    — check whether a node is labelable\n*   [`hast-util-phrasing`](https://github.com/syntax-tree/hast-util-phrasing)\n    — check if a node is phrasing content\n*   [`hast-util-script-supporting`](https://github.com/syntax-tree/hast-util-script-supporting)\n    — check if a node is a script-supporting element\n*   [`hast-util-sectioning`](https://github.com/syntax-tree/hast-util-sectioning)\n    — check if a node is a sectioning element\n*   [`hast-util-transparent`](https://github.com/syntax-tree/hast-util-transparent)\n    — check if a node is a transparent element\n*   [`hast-util-whitespace`](https://github.com/syntax-tree/hast-util-whitespace)\n    — check if a node is inter-element whitespace\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\u003c!-- Definition --\u003e\n\n[build-badge]: https://github.com/syntax-tree/hast-util-heading/workflows/main/badge.svg\n\n[build]: https://github.com/syntax-tree/hast-util-heading/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/hast-util-heading.svg\n\n[coverage]: https://codecov.io/github/syntax-tree/hast-util-heading\n\n[downloads-badge]: https://img.shields.io/npm/dm/hast-util-heading.svg\n\n[downloads]: https://www.npmjs.com/package/hast-util-heading\n\n[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size\u0026query=$.size.compressedSize\u0026url=https://deno.bundlejs.com/?q=hast-util-heading\n\n[size]: https://bundlejs.com/?q=hast-util-heading\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[spec]: https://html.spec.whatwg.org/multipage/dom.html#heading-content\n\n[hast]: https://github.com/syntax-tree/hast\n\n[node]: https://github.com/syntax-tree/hast#nodes\n\n[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting\n\n[api-heading]: #headingvalue\n","funding_links":["https://github.com/sponsors/unifiedjs","https://opencollective.com/unified"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyntax-tree%2Fhast-util-heading","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsyntax-tree%2Fhast-util-heading","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyntax-tree%2Fhast-util-heading/lists"}