{"id":37066301,"url":"https://github.com/jamogriff/markup-front-matter-parser","last_synced_at":"2026-01-14T07:46:48.522Z","repository":{"id":309226761,"uuid":"1035068413","full_name":"jamogriff/markup-front-matter-parser","owner":"jamogriff","description":"An OOP-y Python package to parse front matter from markup files","archived":false,"fork":false,"pushed_at":"2025-08-14T19:12:03.000Z","size":28,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-24T19:37:44.317Z","etag":null,"topics":["factory-pattern","front-matter","html","markdown","markup","parser","python"],"latest_commit_sha":null,"homepage":"","language":"Python","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/jamogriff.png","metadata":{"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,"zenodo":null}},"created_at":"2025-08-09T15:32:55.000Z","updated_at":"2025-08-24T20:59:10.000Z","dependencies_parsed_at":"2025-08-14T21:18:13.338Z","dependency_job_id":null,"html_url":"https://github.com/jamogriff/markup-front-matter-parser","commit_stats":null,"previous_names":["jamogriff/md-front-matter-parser","jamogriff/markup-front-matter-parser"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/jamogriff/markup-front-matter-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamogriff%2Fmarkup-front-matter-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamogriff%2Fmarkup-front-matter-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamogriff%2Fmarkup-front-matter-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamogriff%2Fmarkup-front-matter-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamogriff","download_url":"https://codeload.github.com/jamogriff/markup-front-matter-parser/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamogriff%2Fmarkup-front-matter-parser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28413491,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T05:26:33.345Z","status":"ssl_error","status_checked_at":"2026-01-14T05:21:57.251Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["factory-pattern","front-matter","html","markdown","markup","parser","python"],"created_at":"2026-01-14T07:46:47.861Z","updated_at":"2026-01-14T07:46:48.504Z","avatar_url":"https://github.com/jamogriff.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Markup Front Matter Parser\n\nThis is an OOP-y Python package for parsing the Front Matter of markup files (e.g. .md, .html).\nFront Matter is a `YAML` snippet at the top of a markup file that stores metadata\nthat is used commonly in [Jekyll](https://jekyllrb.com/docs/front-matter/) static sites.\n\nNote that this package is a simple front matter parser that will only parse single\nline key-values. It currently __does not support__ parsing multi-line front matter mapping entries (e.g. `YAML` lists).\n\n\n## Usage\n\nInstall the package with:\n```\npip install markup-front-matter-parser\n```\n\nIn your code import the following:\n```\nfrom markup_front_matter_parser import FrontMatterParserFactory, InvalidFrontMatterError\n```\n**Note:** If you'd like to add type-hints to objects, then you can additionally import `MarkupFile`, `MarkupContent`, and `FileFormat`.\n\nTo use in your code, start by creating an instance of `FrontMatterParserFactory` and then call `get_parser()` with the desired file you want parsed:\n```\nparser_factory = FrontMatterParserFactory()\nparser: AbstractFrontMatterParser = parser_factory.get_parser(\"songs/crazy-train.md\")\n```\n\nObtaining the parser may raise a `ValueError` if the file type is incompatible and a `FileNotFoundError` if the file is not found.\nCalling `parse()` on this parser instance will return a `MarkupFile` instance that contains the parsed front matter and other attributes:\n```\ntry:\n    markup_file: MarkupFile = parser.parse()\nexcept InvalidFrontMatterException as e:\n    [...]\n```\n\nFor example, parsing the file `crazy_train.md`:\n```\n---\nname: Crazy Train\nartist: Ozzy Osbourne\n---\n# This is content.\nHooray for content\n```\n\nWould result in a `MarkupFile` object composed of:\n- A front_matter attribute: `{\"name\": \"Crazy Train\", \"artist\": \"Ozzy Osbourne\"}`\n- A content attribute (an instance of `MarkupContent` [specifically the `raw` attribute]): `\"# This is content.\\nHooray for content\\n\"`\n- A path attribute: `\"crazy_train.md\"`\n- A file_format attribute: `FileFormat.MARKDOWN`\n\nThe `parse()` method will raise an informative `InvalidFrontMatterError` if the file's front matter cannot be parsed.\n\n\n## Code Overview\n\nThis was written within the context of an in-depth sprint of learning Python, so it may not be the most practical package for the job.\nThe architecture of the package uses the factory pattern and was designed so that future improvements would not change the public API.\nIn addition, each subclass of `AbstractFrontMatterParser` could easily implement their own tokenizing of file-specific markup content.\nIn this fashion, the package could then become a holistic markup parser rather than solely just a front matter parser.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamogriff%2Fmarkup-front-matter-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamogriff%2Fmarkup-front-matter-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamogriff%2Fmarkup-front-matter-parser/lists"}