{"id":11315,"library":"micromark-util-html-tag-name","title":"micromark HTML Tag Names Utility","description":"micromark-util-html-tag-name is a low-level utility package within the `micromark` ecosystem, providing curated lists of HTML tag names relevant for CommonMark-compliant Markdown parsing. Specifically, it exports `htmlBlockNames` and `htmlRawNames`, which are used by `micromark` to apply specific parsing rules for HTML (flow) constructs. The `htmlBlockNames` array aids in determining when more relaxed parsing rules apply, based on CommonMark's condition 6, while `htmlRawNames` guides the parser on when HTML content can include lines without exiting until a matching closing tag is found (CommonMark's condition 1). This package is currently in its stable version 2.0.1 and is actively maintained as part of the `micromark` monorepo, which generally sees frequent updates, often with performance enhancements, and drops support for unmaintained Node.js versions with new major releases. It's designed for developers building or extending `micromark` itself, rather than for general HTML tag lookup.","status":"active","version":"2.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/micromark/micromark#main","tags":["javascript","micromark","util","utility","html","tag","name","typescript"],"install":[{"cmd":"npm install micromark-util-html-tag-name","lang":"bash","label":"npm"},{"cmd":"yarn add micromark-util-html-tag-name","lang":"bash","label":"yarn"},{"cmd":"pnpm add micromark-util-html-tag-name","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is ESM-only since v2, requiring ES module import syntax. Attempting CommonJS `require` will result in an error.","wrong":"const htmlBlockNames = require('micromark-util-html-tag-name').htmlBlockNames","symbol":"htmlBlockNames","correct":"import { htmlBlockNames } from 'micromark-util-html-tag-name'"},{"note":"This package is ESM-only since v2, requiring ES module import syntax. Attempting CommonJS `require` will result in an error.","wrong":"const htmlRawNames = require('micromark-util-html-tag-name').htmlRawNames","symbol":"htmlRawNames","correct":"import { htmlRawNames } from 'micromark-util-html-tag-name'"},{"note":"There is no default export from this module; all exports are named. Attempting to import a default will result in a runtime error.","wrong":"import htmlTagNames from 'micromark-util-html-tag-name'","symbol":"all tag names","correct":"import { htmlBlockNames, htmlRawNames } from 'micromark-util-html-tag-name'"}],"quickstart":{"code":"import { htmlBlockNames, htmlRawNames } from 'micromark-util-html-tag-name';\n\nconsole.log('--- HTML Block Names (CommonMark Condition 6) ---');\nconsole.log('These tags allow more relaxed parsing rules within micromark.');\nconsole.log('Examples:', htmlBlockNames.slice(0, 5).join(', ') + '...');\nconsole.log(`Total block tags: ${htmlBlockNames.length}`);\n\nconsole.log('\\n--- HTML Raw Names (CommonMark Condition 1) ---');\nconsole.log('Content within these tags is treated as raw HTML, without further Markdown parsing, until a closing tag is found.');\nconsole.log('Examples:', htmlRawNames.slice(0, 3).join(', ') + '...');\nconsole.log(`Total raw tags: ${htmlRawNames.length}`);\n\n// This utility package primarily provides these lists for use within the micromark parser.\n// It is not intended for general-purpose HTML tag validation or manipulation outside of micromark's context.\n// Developers building custom micromark extensions or alternatives might directly consume these lists.\n","lang":"javascript","description":"This quickstart demonstrates how to import and access the `htmlBlockNames` and `htmlRawNames` arrays, detailing their purpose within the micromark parser's logic for handling HTML tags based on CommonMark specifications."},"warnings":[{"fix":"Migrate your project to use ES modules and ensure Node.js 16+ is used. Replace `require()` calls with `import` statements.","message":"This package is ESM-only since its v2 release. Projects must use ES module import syntax (`import`) and a Node.js version that supports ESM.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Upgrade your Node.js environment to a currently maintained version (e.g., Node.js 16+ for v2.x).","message":"Major versions of `micromark` packages, including this utility, drop support for unmaintained Node.js versions. Version 2.x requires Node.js 16 or higher.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Understand that these lists reflect CommonMark specifications for Markdown parsing, not general HTML standards. Consult HTML specifications or dedicated HTML parsing libraries for broader use cases.","message":"The exported lists (`htmlBlockNames`, `htmlRawNames`) are specific to `micromark`'s CommonMark parsing implementation. They are not intended as general-purpose, exhaustive lists for all HTML tags or for arbitrary HTML validation/manipulation.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Be aware that new CommonMark versions may introduce or remove tags from these lists. If you're building custom extensions, ensure compatibility with the CommonMark version `micromark` targets.","message":"The contents of `htmlBlockNames` and `htmlRawNames` can change with updates to the CommonMark specification. For example, 'search' was added to `htmlBlockNames` in CommonMark@0.31, and 'textarea' was added to `htmlRawNames` in CommonMark@0.30.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Update your import statement to `import { htmlBlockNames, htmlRawNames } from 'micromark-util-html-tag-name';` and ensure your environment supports ES modules.","cause":"Attempting to import the ESM-only package using CommonJS `require()` syntax.","error":"TypeError: require is not a function"},{"fix":"Correct the import to explicitly use the named exports `htmlBlockNames` and `htmlRawNames`: `import { htmlBlockNames, htmlRawNames } from 'micromark-util-html-tag-name';`.","cause":"Incorrectly trying to import a non-existent default export or an aggregation that doesn't exist.","error":"SyntaxError: Named export 'htmlTagNames' not found. The requested module 'micromark-util-html-tag-name' does not provide an export named 'htmlTagNames'"}],"ecosystem":"npm"}