{"id":21947745,"url":"https://github.com/valpackett/microformats2-parser","last_synced_at":"2025-04-22T23:44:10.446Z","repository":{"id":27408682,"uuid":"30885550","full_name":"valpackett/microformats2-parser","owner":"valpackett","description":"A Microformats 2 parser for Haskell | now on https://codeberg.org/valpackett/microformats2-parser - GH used for Actions only","archived":false,"fork":false,"pushed_at":"2022-10-18T00:51:36.000Z","size":249,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"trunk","last_synced_at":"2025-03-29T20:04:10.638Z","etag":null,"topics":["haskell","indieweb","microformats"],"latest_commit_sha":null,"homepage":"https://unrelenting.technology/mf2/","language":"Haskell","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/valpackett.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-16T19:59:34.000Z","updated_at":"2022-10-16T14:29:37.000Z","dependencies_parsed_at":"2023-01-14T06:41:04.017Z","dependency_job_id":null,"html_url":"https://github.com/valpackett/microformats2-parser","commit_stats":null,"previous_names":["unrelentingtech/microformats2-parser"],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valpackett%2Fmicroformats2-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valpackett%2Fmicroformats2-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valpackett%2Fmicroformats2-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valpackett%2Fmicroformats2-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/valpackett","download_url":"https://codeload.github.com/valpackett/microformats2-parser/tar.gz/refs/heads/trunk","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250343755,"owners_count":21415035,"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","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":["haskell","indieweb","microformats"],"created_at":"2024-11-29T05:09:31.431Z","updated_at":"2025-04-22T23:44:10.410Z","avatar_url":"https://github.com/valpackett.png","language":"Haskell","readme":"[![Hackage](https://img.shields.io/hackage/v/microformats2-parser.svg?style=flat)](https://hackage.haskell.org/package/microformats2-parser)\n[![unlicense](https://img.shields.io/badge/un-license-green.svg?style=flat)](https://unlicense.org)\n\n# microformats2-parser\n\n[Microformats 2] parser for Haskell! [#IndieWeb]\n\n- parses `items`, `rels`, `rel-urls`\n- resolves relative URLs (with support for the `\u003cbase\u003e` tag), including inside of `html` for `e-*` properties\n- parses the [value-class-pattern](http://microformats.org/wiki/value-class-pattern), including date and time normalization\n- handles malformed HTML (the actual HTML parser is [tagstream-conduit])\n- also can convert to [JF2]\n- high performance\n- extensively tested\n\nAlso check out [http-link-header] because you often need to read links from the Link header!\n\n[Microformats 2]: http://microformats.org/wiki/microformats2\n[#IndieWeb]: https://indieweb.org\n[tagstream-conduit]: https://hackage.haskell.org/package/tagstream-conduit\n[JF2]: https://www.w3.org/TR/jf2/\n[http-link-header]: https://codeberg.org/valpackett/http-link-header\n\n## [DEMO PAGE](https://unrelenting.technology/mf2/)\n\n## Usage\n\nLook at the API docs [on Hackage](https://hackage.haskell.org/package/microformats2-parser) for more info, here's a quick overview:\n\n```haskell\n{-# LANGUAGE OverloadedStrings #-}\n\nimport Data.Microformats2.Parser\nimport Data.Default\nimport Network.URI\n\nparseMf2 def $ documentRoot $ parseLBS \"\u003cbody\u003e\u003cp class=h-entry\u003e\u003ch1 class=p-name\u003eYay!\u003c/h1\u003e\u003c/p\u003e\u003c/body\u003e\"\n\nparseMf2 (def { baseUri = parseURI \"https://where.i.got/that/page/from/\" }) $ documentRoot $ parseLBS \"\u003cbody\u003e\u003cbase href=\\\"base/\\\"\u003e\u003clink rel=micropub href='micropub'\u003e\u003cp class=h-entry\u003e\u003ch1 class=p-name\u003eYay!\u003c/h1\u003e\u003c/p\u003e\u003c/body\u003e\"\n```\n\nThe `def` is the [default](https://hackage.haskell.org/package/data-default-class-0.0.1/docs/Data-Default-Class.html) configuration.\n\nThe configuration includes:\n- `htmlMode`, an HTML parsing mode (`Unsafe` | `Escape` | **`Sanitize`**)\n- `baseUri`, the `Maybe URI` that represents the address you retrieved the HTML from, used for resolving relative addresses -- you should set it\n\n`parseMf2` will return an Aeson [Value](https://hackage.haskell.org/package/aeson-0.8.0.2/docs/Data-Aeson-Types.html#t:Value) structured like [canonical microformats2 JSON](http://microformats.org/wiki/microformats2).\n[lens-aeson](https://hackage.haskell.org/package/lens-aeson) is a good way to navigate it.\n\n## Development\n\nUse [stack] to build.  \nUse ghci to run tests quickly with `:test` (see the `.ghci` file).\n\n```bash\n$ stack build\n\n$ stack test\n\n$ stack ghci\n```\n\n[stack]: https://github.com/commercialhaskell/stack\n\n## License\n\nThis is free and unencumbered software released into the public domain.  \nFor more information, please refer to the `UNLICENSE` file or [unlicense.org](https://unlicense.org).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalpackett%2Fmicroformats2-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvalpackett%2Fmicroformats2-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalpackett%2Fmicroformats2-parser/lists"}