{"id":13500153,"url":"https://github.com/makew0rld/md2gemini","last_synced_at":"2025-12-12T02:30:52.772Z","repository":{"id":40825434,"uuid":"264547992","full_name":"makew0rld/md2gemini","owner":"makew0rld","description":"File converter from Markdown to Gemini.","archived":true,"fork":false,"pushed_at":"2023-08-06T19:25:15.000Z","size":105,"stargazers_count":163,"open_issues_count":8,"forks_count":16,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-05-21T05:04:04.037Z","etag":null,"topics":["converts","gemini","markdown","python","python3"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/makew0rld.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"makeworld-the-better-one","ko_fi":"makeworld"}},"created_at":"2020-05-16T23:38:11.000Z","updated_at":"2024-02-02T21:54:23.000Z","dependencies_parsed_at":"2024-01-07T21:55:30.370Z","dependency_job_id":null,"html_url":"https://github.com/makew0rld/md2gemini","commit_stats":null,"previous_names":["makeworld-the-better-one/md2gemini"],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makew0rld%2Fmd2gemini","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makew0rld%2Fmd2gemini/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makew0rld%2Fmd2gemini/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makew0rld%2Fmd2gemini/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/makew0rld","download_url":"https://codeload.github.com/makew0rld/md2gemini/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222465861,"owners_count":16989096,"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":["converts","gemini","markdown","python","python3"],"created_at":"2024-07-31T22:00:51.851Z","updated_at":"2025-12-12T02:30:47.735Z","avatar_url":"https://github.com/makew0rld.png","language":"Python","funding_links":["https://github.com/sponsors/makeworld-the-better-one","https://ko-fi.com/makeworld"],"categories":["ATOM/RSS Feeds"],"sub_categories":["Generators"],"readme":"# md2gemini\n\n[![PyPI downloads](https://img.shields.io/pypi/dm/md2gemini)](https://pypi.org/project/md2gemini)\n[![License image](https://img.shields.io/github/license/makeworld-the-better-one/md2gemini)](https://www.gnu.org/licenses/lgpl-3.0.en.html)\n\nConverter from Markdown to the [Gemini](https://gemini.circumlunar.space/) text format. It works as a Python module, or a command line application.\n\nOne of its key features is that it can convert inline links into footnotes. It also supports tables, and will convert them into Unicode (or ASCII) tables.\n\nAnything else that it doesn't understand will remain the same as when you wrote it, like strikethrough for example.\n\n## Project Status\n\nmd2gemini is now archived. It’s always been a pile of hacks, and now I’m not that invested in continuing it. See my [blog post](https://www.makeworld.space/2023/08/bye_gemini.html) for details.\n\n## Link modes\n\nmd2gemini has several link modes, because text/gemini doesn't support inline links. These modes can be set by passing different strings to the `-l` or `--links` flags on the command line, or the `links=` argument in Python.\n\nHere is some example markdown, to show what each link mode does:\n```markdown\nThis is a paragraph with an [inline](https://example.com) link.\nHere is [another](https://example.org/) link, part of the same paragraph.\n\nThis is a second paragraph, with a different [link](https://duck.com) in it.\n```\n\nLink modes:\n\n### default\nThis is what happens when don't specify what link mode you want, or put any invalid string. It is also called \"newline\" mode. It is likely the worst link mode for reading.\n\nOutput:\n```\nThis is a paragraph with an\n=\u003e https://example.com inline\nlink.\nHere is\n=\u003e https://example.org/ another\nlink, part of the same paragraph.\n\nThis is a second paragraph, with a different\n=\u003e https://duck.com link\nin it.\n```\n\n### off\nThis will remove all links.\n\nOutput:\n```\nThis is a paragraph with an inline link. Here is another link, part of the same paragraph.\n\nThis is a second paragraph, with a different link in it.\n```\n\n### paragraph\nThis will result in footnotes being added to the document, and the links for each footnote being added at the end of each paragraph.\n\nOutput:\n```\nThis is a paragraph with an inline[1] link. Here is another[2] link, part of the same paragraph.\n\n=\u003e https://example.com 1: https://example.com\n=\u003e https://example.org/ 2: https://example.org/\n\nThis is a second paragraph, with a different link[3] in it.\n\n=\u003e https://duck.com 3: https://duck.com\n```\n\n### at-end\nThis is the same as **paragraph**, but all the links for the footnotes are added at the very end of the document.\n\nOutput:\n```\nThis is a paragraph with an inline[1] link. Here is another[2] link, part of the same paragraph.\n\nThis is a second paragraph, with a different link[3] in it.\n\n=\u003e https://example.com 1: https://example.com\n=\u003e https://example.org/ 2: https://example.org/\n=\u003e https://duck.com 3: https://duck.com\n```\n\n### copy\nThis link mode doesn't add any footnotes inside the paragraph, but creates a link with the inline link text at the end of the paragraph. [Here's](https://user-images.githubusercontent.com/25111343/85186965-0b0e8580-b26a-11ea-8cb7-aa22ca6745af.png) a screenshot showing what this mode ends up looking like - using my [Amfora](https://github.com/makeworld-the-better-one/amfora) browser.\n\nOutput:\n```\nThis is a paragraph with an inline link. Here is another link, part of the same paragraph.\n\n=\u003e https://example.com inline\n=\u003e https://example.org/ another\n\nThis is a second paragraph, with a different link in it.\n\n=\u003e https://duck.com link\n```\n\n## Installation\n```\npip3 install md2gemini\n```\nYou may also want to use the `--user` flag after `install`, to only install the package for your user.\n\nNote that this package only officially supports Python 3.\n\n## Usage\n\nIt works directly in Python, or on the command line. The command line version can work with unix pipes as well, reading files from stdin and writing to stdout if desired.\n\n### Command line\n```\nusage: md2gemini [-h] [--version] [-w] [-d DIR] [-a] [-f] [-j]\n                 [--code-tag CODE_TAG] [--img-tag IMG_TAG]\n                 [--table-tag TABLE_TAG] [-i INDENT] [-l LINKS] [-p] [-s]\n                 [-b BASE_URL] [-m]\n                 [file [file ...]]\n\nConvert markdown to gemini.\n\npositional arguments:\n  file                  Files to convert. If no files are specified then data\n                        will be read from stdin and printed to stdout.\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --version             show program's version number and exit\n  -w, --write           Write output to a new file of the same name, but with\n                        a .gmi extension.\n  -d DIR, --dir DIR     The directory to write files to, if --write is used.\n  -a, --ascii-table     Use ASCII to create tables, not Unicode.\n  -f, --frontmatter     Remove Jekyll and Zola style front matter before\n                        converting.\n  -j, --jekyll          Skip jekyll frontmatter when processing - DEPRECATED.\n  --code-tag CODE_TAG   What alt text to add to unlabeled code blocks.\n                        Defaults to empty string.\n  --img-tag IMG_TAG     What text to add after image links. Defaults to\n                        '[IMG]'. Write something like --img-tag='' to remove\n                        it.\n  --table-tag TABLE_TAG\n                        What alt text to add to table blocks. Defaults to\n                        'table'. Write something like --table-tag='' to remove\n                        it.\n  -i INDENT, --indent INDENT\n                        The number of spaces to use for list indenting. Put\n                        'tab' to use a tab instead.\n  -l LINKS, --links LINKS\n                        Set to 'off' to turn off links, 'paragraph' to have\n                        footnotes at the end of each paragraph, or 'at-end' to\n                        have footnotes at the end of the document. You can\n                        also set it to 'copy' to put links that copy the\n                        inline link text after each paragraph. Not using this\n                        flag, or having any other value will result in\n                        regular, newline links.\n  -p, --plain           Remove special markings from output that text/gemini\n                        doesn't support, like the asterisks for bold and\n                        italics, and inline HTML\n  -s, --strip-html      Strip all inline and block HTML from Markdown. Note\n                        that using --plain will strip inline HTML as well.\n  -b BASE_URL, --base-url BASE_URL\n                        All links starting with a slash will have this URL\n                        prepended to them.\n  -m, --md-links        Convert all links to local files ending in .md to end\n                        with .gmi instead.\n  -c, --no-checklist    Disable rendering of GitHub-style checklist list\n                        items: [ ] and [x]\n\n```\n\n### In Python\n```python\nfrom md2gemini import md2gemini\n# Load a markdown file's contents into memory and get conversion\nwith open(\"example.md\", \"r\") as f:\n    gemini = md2gemini(f.read())\n# Now the gemini variable contains your converted text as a string\n```\nOptions for the `md2gemini` function are similar to the command line ones above, except for the parameter `link_func` which cannot be used from the command line.\n```python\ndef md2gemini(markdown, code_tag=\"\", img_tag=\"[IMG]\", indent=\" \",\n              ascii_table=False, frontmatter=False, jekyll=False,\n              links=\"newline\", plain=False, strip_html=False,\n              base_url=\"\", md_links=False, link_func=None,\n              table_tag=\"table\", checklist=True):\n    \"\"\"Convert the provided markdown text to the gemini format.\n    code_tag: The default alt text for code blocks.\n\n    img_tag: The text added after an image link, to indicate it's an image.\n    \n    indent: How much to indent sub-levels of a list. Put several spaces, or \\\\t for a tab.\n    \n    ascii_table: Use ASCII to create tables, not Unicode.\n\n    frontmatter: Remove Jekyll and Zola style front matter before converting.\n\n    jekyll: Skip jekyll frontmatter when processing - DEPRECATED.\n\n    links: Set to 'off' to turn off links, 'paragraph' to have footnotes at the end of each\n    paragraph, or 'at-end' to have footnotes at the end of the document. You can also set it\n    to 'copy' to put links that copy the inline link text after each paragraph. Not using this\n    flag, or having any other value will result in regular, newline links.\n\n    plain: Set to True to remove special markings from output that text/gemini doesn't support,\n    like the asterisks for bold and italics, as well as inline HTML.\n\n    strip_html: Strip all inline and block HTML from Markdown.\n\n    base_url: All links starting with a slash will have this URL prepended to them.\n\n    md_links: Convert all links to local files ending in .md to end with .gmi instead.\n\n    link_func: Custom function to apply to links. This function takes a string containing the link\n    URL as parameter, and should return the new link.\n\n    table_tag: \"The default alt text for table blocks.\"\n\n    checklist: whether to support GitHub-style checklist list items: [ ] and [x]\n    \"\"\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmakew0rld%2Fmd2gemini","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmakew0rld%2Fmd2gemini","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmakew0rld%2Fmd2gemini/lists"}