{"library":"microformats-parser","title":"Microformats v2 Parser","description":"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.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install microformats-parser"],"cli":null},"imports":["import { mf2 } from 'microformats-parser'","const { mf2 } = require('microformats-parser')","import type { MicroformatRoot } from 'microformats-parser'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { mf2 } from 'microformats-parser';\n\nconst htmlString = '<a class=\"h-card\" href=\"/\" rel=\"me\">Jimmy</a>';\nconst options = {\n  baseUrl: \"http://example.com/\" // baseUrl is required to resolve relative URLs\n};\n\nconst parsed = mf2(htmlString, options);\n\nconsole.log(JSON.stringify(parsed, null, 2));\n\n// Expected output:\n// {\n//   \"items\": [\n//     {\n//       \"properties\": {\n//         \"name\": [\"Jimmy\"],\n//         \"url\": [\"http://example.com/\"]\n//       },\n//       \"type\": [\"h-card\"]\n//     }\n//   ],\n//   \"rel-urls\": {\n//     \"http://example.com/\": {\n//       \"rels\": [\"me\"],\n//       \"text\": \"Jimmy\"\n//     }\n//   },\n//   \"rels\": {\n//     \"me\": [\"http://example.com/\"]\n//   }\n// }","lang":"typescript","description":"Demonstrates basic parsing of an HTML string containing an h-card microformat, resolving a relative URL with a `baseUrl`.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}