microformats-parser is a JavaScript library for parsing HTML content to extract microformats v2 data, strictly adhering to the microformats2 parsing specification. It also provides back-compatibility for microformats v1, though with limited support to the official test suite. The library, currently at version 2.0.4, is actively maintained with frequent releases (roughly monthly or bi-monthly) for bug fixes and dependency updates. It supports both Node.js (requiring Node.js >=18) and browser environments. Its primary differentiator is its close adherence to the specification, robust handling of implied properties, and features for resolving relative URLs, making it a reliable choice for Indieweb and semantic web applications.
npm install microformats-parserVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic parsing of an HTML string containing an h-card microformat, resolving a relative URL with a `baseUrl`.
Upgrade your Node.js environment to version 18 or higher.
Use experimental options with caution in production environments and monitor release notes for changes if relying on them.
For critical applications, convert v1 microformats to v2 or thoroughly test v1 parsing outcomes.
Always provide a valid `baseUrl` string in the options object to ensure accurate URL resolution.
Change your import statement to `import { mf2 } from 'microformats-parser';`Ensure the `options` object passed to `mf2()` includes a valid `baseUrl` string, e.g., `{ baseUrl: 'http://example.com/' }`.Always pass a valid HTML string as the first argument to `mf2()`, e.g., `mf2('<html>...</html>', options)`.No dependency data recorded yet.