{"id":17962558,"url":"https://github.com/eneko/markdowngenerator","last_synced_at":"2025-06-24T13:08:38.674Z","repository":{"id":54629882,"uuid":"106245838","full_name":"eneko/MarkdownGenerator","owner":"eneko","description":"Swift library to programmatically generate Markdown output and files","archived":false,"fork":false,"pushed_at":"2021-02-07T04:06:44.000Z","size":113,"stargazers_count":100,"open_issues_count":1,"forks_count":60,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-06T03:36:36.154Z","etag":null,"topics":["generator","markdown","swift","swift-framework","swift-package","swift-package-manager"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eneko.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null},"funding":{"github":"eneko","patreon":"eneko"}},"created_at":"2017-10-09T06:42:14.000Z","updated_at":"2025-04-28T10:37:52.000Z","dependencies_parsed_at":"2022-08-13T22:01:02.744Z","dependency_job_id":null,"html_url":"https://github.com/eneko/MarkdownGenerator","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/eneko/MarkdownGenerator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eneko%2FMarkdownGenerator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eneko%2FMarkdownGenerator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eneko%2FMarkdownGenerator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eneko%2FMarkdownGenerator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eneko","download_url":"https://codeload.github.com/eneko/MarkdownGenerator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eneko%2FMarkdownGenerator/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261682921,"owners_count":23193677,"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":["generator","markdown","swift","swift-framework","swift-package","swift-package-manager"],"created_at":"2024-10-29T11:19:44.955Z","updated_at":"2025-06-24T13:08:38.495Z","avatar_url":"https://github.com/eneko.png","language":"Swift","funding_links":["https://github.com/sponsors/eneko","https://patreon.com/eneko"],"categories":[],"sub_categories":[],"readme":"# MarkdownGenerator\n\n\n![Release](https://img.shields.io/github/release/eneko/markdowngenerator.svg)\n![Swift 4.0+](https://img.shields.io/badge/Swift-4.0+-orange.svg)\n[![Build Status](https://travis-ci.com/eneko/MarkdownGenerator.svg?branch=main)](https://travis-ci.com/eneko/MarkdownGenerator)\n![CI](https://github.com/eneko/MarkdownGenerator/workflows/CI/badge.svg)\n[![codecov](https://codecov.io/gh/eneko/MarkdownGenerator/branch/master/graph/badge.svg)](https://codecov.io/gh/eneko/MarkdownGenerator)\n[![Swift Package Manager Compatible](https://img.shields.io/badge/spm-compatible-brightgreen.svg)](https://swift.org/package-manager)\n![Linux Compatible](https://img.shields.io/badge/linux-compatible%20🐧-brightgreen.svg)\n\nA small Swift library to generate Markdown documents.\n\n**Features**\n- ✅ Easily generate Markdown from structured data\n- ✅ Extendible: make your classes and structs conform to `MarkdownConvertible`\n- ✅ Swift Package Manager compatible (Swift 4.0+)\n- ✅ Linux compatible 🐧\n\n\n## MarkdownConvertible\nTypes conforming to the `MarkdownConvertible` protocol can be rendered as a\nmarkdown string, by implementing the `.markdown` computed property.\n\nOut of the box, `MarkdownGenerator` provides the following Markdown elements:\n\n- Unordered lists\n- Ordered lists\n- Tables\n- Block-quotes\n- Code Blocks\n- Collapsible Blocks\n- Images\n- Links\n- Headings\n\nPlease take a look at the following examples, or read the [reference documentation](/docs).\n\n### Lists\nList can be nested to any levels and contain single or multi-line items. Lists can be ordered, unordered, or mixed.\n\n```swift\nlet list = MarkdownList(items: [\"🍏\", \"🍌\", \"🍊\", \"🍇\"])\nprint(list.markdown)\n```\n\nGenerates the following output:\n\n    -   🍏\n    -   🍌\n    -   🍊\n    -   🍇\n\nWhich renders as:\n\n-   🍏\n-   🍌\n-   🍊\n-   🍇\n\n\n### Tables\nWhile Markdown didn't have support for tables originally, most modern Markdown readers (including GitHub) properly render tables nowadays.\n\n```swift\nlet data: [[String]] = [\n    [\"🍏\", \"Apple\", \"Fruits\"],\n    [\"🍊\", \"Orange\", \"Fruits\"],\n    [\"🥖\", \"Bread\", \"Bakery\"],\n]\nlet table = MarkdownTable(headers: [\"\", \"Name\", \"Department\"], data: data)\nprint(table.markdown)\n```\n\nGenerates the following output:\n\n    |    | Name   | Department |\n    | -- | ------ | ---------- |\n    | 🍏 | Apple  | Fruits     |\n    | 🍊 | Orange | Fruits     |\n    | 🥖 | Bread  | Bakery     |\n\nWhich renders as:\n\n|    | Name   | Department |\n| -- | ------ | ---------- |\n| 🍏 | Apple  | Fruits     |\n| 🍊 | Orange | Fruits     |\n| 🥖 | Bread  | Bakery     |\n\nPretty tables 🎉\n\n### Blockquotes\n\nAny `MarkdownConvertible` content (including `String`) can be easily `.blockquoted`.\n\n```swift\nlet input = \"\"\"\n## This is a header.\n\n1.   This is the first list item.\n2.   This is the second list item.\n\nHere's some example code:\n\n    return shell_exec(\"echo $input | $markdown_script\");\n\n\u003e This is a quote.\n\"\"\"\n\nprint(input.blockquoted.markdown)\n```\n\nGenerates the following output:\n\n    \u003e ## This is a header.\n    \u003e\n    \u003e 1.   This is the first list item.\n    \u003e 2.   This is the second list item.\n    \u003e\n    \u003e Here's some example code:\n    \u003e\n    \u003e     return shell_exec(\"echo $input | $markdown_script\");\n    \u003e\n    \u003e \u003e This is a quote.\n\nWhich renders as:\n\n\u003e ## This is a header.\n\u003e\n\u003e 1.   This is the first list item.\n\u003e 2.   This is the second list item.\n\u003e\n\u003e Here's some example code:\n\u003e\n\u003e     return shell_exec(\"echo $input | $markdown_script\");\n\u003e\n\u003e \u003e This is a quote.\n\n\n### Collapsible Blocks\nCollapsible blocks look great on GitHub and other Markdown viewers. Great way to provide detailed content without cluttering the output.\n\n```swift\nlet details: [MarkdownConvertible] = [\n    MarkdownHeader(title: \"Title\"),\n    MarkdownList(items: [\"🐶\", \"🐱\", \"🦊\"]),\n    MarkdownTable(headers: [\"Name\", \"Count\"], data: [[\"Dog\", \"1\"], [\"Cat\", \"2\"]]),\n    MarkdownCodeBlock(code: \"let foo = Bar()\", style: .backticks(language: \"swift\"))\n]\n\nprint(MarkdownCollapsibleSection(summary: \"This is cool stuff\", details: details).markdown)\n```\n\nGenerates the following output:\n\n    \u003cdetails\u003e\u003csummary\u003eThis is cool stuff\u003c/summary\u003e\n\n    # Title\n\n    -   🐶\n    -   🐱\n    -   🦊\n\n    | Name | Count |\n    | ---- | ----- |\n    | Dog  | 1     |\n    | Cat  | 2     |\n\n    ```swift\n    let foo = Bar()\n    ```\n    \u003c/details\u003e\n\nWhich renders as (click to expand):\n\n\u003cdetails\u003e\u003csummary\u003eThis is cool stuff\u003c/summary\u003e\n\n# Title\n\n-   🐶\n-   🐱\n-   🦊\n\n| Name | Count |\n| ---- | ----- |\n| Dog  | 1     |\n| Cat  | 2     |\n\n```swift\nlet foo = Bar()\n```\n\u003c/details\u003e\n\n\n## Contact\nFollow and/or contact me on Twitter at [@eneko](https://www.twitter.com/eneko).\n\n\n## Contributions\nIf you find an issue, just [open a ticket](https://github.com/eneko/MarkdownGenerator/issues/new)\non it. Pull requests are warmly welcome as well.\n\n\n## License\nMarkdownGenerator is licensed under the Apache 2.0 license. See [LICENSE](/LICENSE) for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feneko%2Fmarkdowngenerator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feneko%2Fmarkdowngenerator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feneko%2Fmarkdowngenerator/lists"}