{"id":16483450,"url":"https://github.com/dbohdan/gmi2md","last_synced_at":"2026-05-18T19:36:02.376Z","repository":{"id":253160434,"uuid":"841016772","full_name":"dbohdan/gmi2md","owner":"dbohdan","description":"Convert gemtext to Markdown (CLI + PHP)","archived":false,"fork":false,"pushed_at":"2024-09-13T18:54:35.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-11T12:17:22.086Z","etag":null,"topics":["converter","gemini-protocol","gemtext","markdown","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/dbohdan.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}},"created_at":"2024-08-11T11:51:58.000Z","updated_at":"2024-12-19T10:45:13.000Z","dependencies_parsed_at":"2024-09-14T09:25:23.272Z","dependency_job_id":"836037bd-66b1-4ab3-9793-a29bded5fca3","html_url":"https://github.com/dbohdan/gmi2md","commit_stats":null,"previous_names":["dbohdan/gmi2md"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbohdan%2Fgmi2md","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbohdan%2Fgmi2md/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbohdan%2Fgmi2md/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbohdan%2Fgmi2md/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dbohdan","download_url":"https://codeload.github.com/dbohdan/gmi2md/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241215358,"owners_count":19928468,"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":["converter","gemini-protocol","gemtext","markdown","php"],"created_at":"2024-10-11T13:14:02.660Z","updated_at":"2026-05-18T19:35:57.330Z","avatar_url":"https://github.com/dbohdan.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿# gmi2md\n\n**gmi2md** is a command-line utility and PHP library\nfor converting [gemtext](https://geminiprotocol.net/docs/gemtext.gmi) to Markdown.\n\n## Requirements\n\n- PHP 8.0 or later to run gmi2md\n- diff(1) and [just](https://github.com/casey/just) to test it\n- [pretty-php](https://github.com/lkrms/pretty-php) and just to format the code\n\n## Usage\n\n### CLI\n\n```shell\n./gmi2md.php \u003c tests/input.gmi\n```\n\n### PHP\n\nThe following code is also in [`example.php`](example.php).\n\n```php\n\u003c?php\n\ninclude 'gmi2md.php';\n\n$converter = new GemtextToMarkdownConverter();\necho $converter-\u003econvert(file_get_contents('tests/input.gmi'));\n```\n\n## Design\n\ngmi2md translates gemtext to a subset of Markdown that is compatible with major Markdown variants: CommonMark, GFM, Pandoc, and John Gruber's original Markdown.\nIt preserves vertical whitespace.\n\nIn gemtext, if one line follows another, the lines are separate paragraphs;\nin Markdown, the lines are merged into a single paragraph.\ngmi2md separates gemtext paragraphs with a blank line to make them paragraphs in Markdown.\n\nI have made a stylistic decision to merge links into one Markdown paragraph in the output when they directly follow each other in the gemtext input.\nWhat this mean is that we do not insert blank lines between links to make them different paragraphs.\nRather, each line with a link after a paragraph or after the first link of the group when there is no preceding paragraph is prefixed with `\u003cbr\u003e` in the Markdown output.\n\nThe gemtext in the first of the following code blocks is translated to the Markdown in the second:\n\n```gemtext\nLorem ipsum.\n=\u003e https://example.com/1\n=\u003e gemini://example.com/2\n```\n\n```markdown\nLorem ipsum.\n\u003cbr\u003e\u003chttps://example.com/\u003e\n\u003cbr\u003e[gemini://example.com/2](gemini://example.com/2)\n```\n\nGemtext where the links are separated with newlines is translated differently:\n\n```gemtext\nLorem ipsum.\n\n=\u003e https://example.com/1\n\n=\u003e gemini://example.com/2\n```\n\n```markdown\nLorem ipsum.\n\n\u003chttps://example.com/\u003e\n\n[gemini://example.com/2](gemini://example.com/2)\n```\n\nTo change this behavior, instantiate the converter with a separator prefix other than the default `\u003cbr\u003e`.\nFor example:\n\n```php\n// No link grouping. Insert blank lines.\n$converter = new GemtextToMarkdownConverter(\"\\n\");\n```\n\n## Development\n\ngmi2md was written by Claude 3.5 Sonnet for the initial commit, fixed and improved in various ways by a human, and refactored by Claude.\nIt was a first for me.\nI have [written about its development](https://dbohdan.com/gmi2md).\n\n## License\n\nCopyright law is not yet clear about generated code.\nThis code is a combination of machine and human contributions.\nOne may expect that the code will be considered an original and copyrightable work.\nI am therefore releasing it under the MIT License.\nSee [`LICENSE`](LICENSE).\nI am not a lawyer.\nUse code that is partially generated by AI at your own risk.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbohdan%2Fgmi2md","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdbohdan%2Fgmi2md","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbohdan%2Fgmi2md/lists"}