{"id":18427164,"url":"https://github.com/fjebaker/md4zig","last_synced_at":"2026-03-02T04:33:57.637Z","repository":{"id":238574779,"uuid":"796854274","full_name":"fjebaker/md4zig","owner":"fjebaker","description":"Zig wrapper around md4c for parsing Markdown.","archived":false,"fork":false,"pushed_at":"2025-09-21T17:15:28.000Z","size":20,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-04T22:43:51.636Z","etag":null,"topics":["markdown","md4c","parser","zig"],"latest_commit_sha":null,"homepage":"","language":"Zig","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/fjebaker.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":"2024-05-06T18:46:27.000Z","updated_at":"2025-09-21T17:15:32.000Z","dependencies_parsed_at":"2025-04-13T19:38:58.782Z","dependency_job_id":"237d9826-1e7c-430d-85ec-5b69c5624dc1","html_url":"https://github.com/fjebaker/md4zig","commit_stats":null,"previous_names":["fjebaker/md4zig"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fjebaker/md4zig","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fjebaker%2Fmd4zig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fjebaker%2Fmd4zig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fjebaker%2Fmd4zig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fjebaker%2Fmd4zig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fjebaker","download_url":"https://codeload.github.com/fjebaker/md4zig/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fjebaker%2Fmd4zig/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29992321,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-02T01:47:34.672Z","status":"online","status_checked_at":"2026-03-02T02:00:07.342Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["markdown","md4c","parser","zig"],"created_at":"2024-11-06T05:09:49.906Z","updated_at":"2026-03-02T04:33:57.621Z","avatar_url":"https://github.com/fjebaker.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"# md4zig\n\nA Zig wrapper around [md4c](https://github.com/mity/md4c) for parsing Markdown.\n\nExposes a single function that puts a parser type together from comptime-known Zig functions. The parses itself also exposes only a single `parse` function. The generalisation to using vtables is left as an exercise to the user.\n\n## Usage\n\n```zig\nconst std = @import(\"std\");\n\nconst md4zig = @import(\"md4zig\");\n\nconst MD4CParser = md4zig.MD4CParser;\nconst BlockInfo = md4zig.BlockInfo;\nconst SpanInfo = md4zig.SpanInfo;\nconst Text = md4zig.Text;\n\nconst Impl = struct {\n    pub fn enterBlock(_: *Impl, block: BlockInfo) !void {\n        std.debug.print(\"\u003e\u003e {any}\\n\", .{block});\n    }\n    pub fn leaveBlock(_: *Impl, block: BlockInfo) !void {\n        std.debug.print(\"\u003c\u003c {any}\\n\", .{block});\n    }\n    pub fn enterSpan(_: *Impl, span: SpanInfo) !void {\n        std.debug.print(\"\u003e\u003e {any}\\n\", .{span});\n    }\n    pub fn leaveSpan(_: *Impl, span: SpanInfo) !void {\n        std.debug.print(\"\u003c\u003c {any}\\n\", .{span});\n    }\n    pub fn textCallback(_: *Impl, text: Text) !void {\n        std.debug.print(\"   {any}\\n\", .{text});\n    }\n};\n\npub fn main() !void {\n    var impl: TestImpl = .{};\n    var parser = MD4CParser(TestImpl).init(.{});\n    try parser.parse(\u0026impl, \"# Hello World\\nHow are *you*!\");\n}\n```\n\nThis will then output something like:\n\n```\n\u003e\u003e main.BlockInfo{ .doc = void }\n\u003e\u003e main.BlockInfo{ .h = main.BlockInfo.BlockInfo__struct_7319{ .level = 1 } }\n   main.Text{ .text = { 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100 }, .text_type = main.TextType.normal }\n\u003c\u003c main.BlockInfo{ .h = main.BlockInfo.BlockInfo__struct_7319{ .level = 1 } }\n\u003e\u003e main.BlockInfo{ .p = void }\n   main.Text{ .text = { 72, 111, 119, 32, 97, 114, 101, 32 }, .text_type = main.TextType.normal }\n\u003e\u003e main.SpanInfo{ .em = void }\n   main.Text{ .text = { 121, 111, 117 }, .text_type = main.TextType.normal }\n\u003c\u003c main.SpanInfo{ .em = void }\n   main.Text{ .text = { 33 }, .text_type = main.TextType.normal }\n\u003c\u003c main.BlockInfo{ .p = void }\n\u003c\u003c main.BlockInfo{ .doc = void }\n```\n\n## Including in a project\n\nUse the Zig package manager\n\n```bash\nzig fetch --save=md4zig https://github.com/fjebaker/md4zig/archive/master.tar.gz\n```\n\nThen include the module in your `build.zig` for your target:\n\n```zig\nconst md4zig = b.dependency(\n    \"md4zig\",\n    .{ .optimize = optimize, .target = target },\n).module(\"md4zig\");\n\n// ...\n\nexe.root_module.addImport(\"md4zig\", md4zig);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffjebaker%2Fmd4zig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffjebaker%2Fmd4zig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffjebaker%2Fmd4zig/lists"}