{"id":24605385,"url":"https://github.com/shiv-source/markdowntable","last_synced_at":"2025-07-10T17:33:10.557Z","repository":{"id":273012602,"uuid":"918460244","full_name":"shiv-source/markdownTable","owner":"shiv-source","description":"A Go package to generate Markdown table","archived":false,"fork":false,"pushed_at":"2025-01-18T02:15:44.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T09:47:57.737Z","etag":null,"topics":["golang","markdown-table","markdowntable","package"],"latest_commit_sha":null,"homepage":"","language":"Go","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/shiv-source.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":"2025-01-18T01:47:48.000Z","updated_at":"2025-01-18T02:24:41.000Z","dependencies_parsed_at":"2025-01-18T03:30:56.737Z","dependency_job_id":null,"html_url":"https://github.com/shiv-source/markdownTable","commit_stats":null,"previous_names":["shiv-source/markdowntable"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/shiv-source/markdownTable","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shiv-source%2FmarkdownTable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shiv-source%2FmarkdownTable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shiv-source%2FmarkdownTable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shiv-source%2FmarkdownTable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shiv-source","download_url":"https://codeload.github.com/shiv-source/markdownTable/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shiv-source%2FmarkdownTable/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264619569,"owners_count":23638473,"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":["golang","markdown-table","markdowntable","package"],"created_at":"2025-01-24T16:17:15.797Z","updated_at":"2025-07-10T17:33:05.550Z","avatar_url":"https://github.com/shiv-source.png","language":"Go","readme":"# markdownTable\n\nA Go package to generate Markdown tables from header and body data. This package automatically adjusts column widths based on the longest entry in each column, ensuring that the table is aligned and visually clear when rendered in Markdown.\n\n## Features\n\n- Converts a given header and body data into a well-formatted Markdown table.\n- Automatically adjusts column widths based on the longest entry (including headers).\n- Truncates rows with fewer columns than the header to maintain consistency.\n- Provides a clean and simple way to create Markdown tables programmatically in Go.\n\n## Installation\n\nTo install the `markdownTable` package, use the following Go command:\n\n```bash\ngo get github.com/shiv-source/markdownTable\n```\n\n## Example Usage\n\nHere’s an example of how to use the `CreateMarkdownTable` function:\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/shiv-source/markdownTable\"\n)\n\nfunc main() {\n\thead := []string{\"ID\", \"Name\", \"Age\"}\n\tbody := [][]string{\n\t\t{\"1\", \"John\", \"26\"},\n\t\t{\"2\", \"Bob\", \"25\"},\n\t\t{\"3\", \"Alice\", \"27\"},\n\t}\n\n\t// Create the Markdown table\n\tmarkdownTable := markdownTable.CreateMarkdownTable(head, body)\n\n\t// Print the Markdown table\n\tfmt.Println(markdownTable)\n}\n```\n\n### Expected Output:\n\n```markdown\n| ID  | Name         | Age |\n|-----|--------------|-----|\n| 1   | John         | 26  |\n| 2   | Bob          | 25  |\n| 3   | Alice        | 27  |\n```\n\n## Function Signature\n\n```go\nfunc CreateMarkdownTable(head []string, body [][]string) string\n```\n\n### Parameters:\n- `head`: A slice of strings representing the column headers of the table.\n- `body`: A slice of slices, where each inner slice represents a row of data in the table.\n\n### Returns:\n- A string containing the Markdown-formatted table.\n\n## Contributing\n\nIf you would like to contribute to this project, feel free to fork the repository, make changes, and create a pull request. All contributions are welcome!\n\n### Steps to contribute:\n\n1. Fork the repository.\n2. Create a feature branch (`git checkout -b feature-name`).\n3. Commit your changes (`git commit -am 'Add new feature'`).\n4. Push to the branch (`git push origin feature-name`).\n5. Create a pull request.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshiv-source%2Fmarkdowntable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshiv-source%2Fmarkdowntable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshiv-source%2Fmarkdowntable/lists"}