{"id":15483211,"url":"https://github.com/simonecorsi/go-declarative-markdown","last_synced_at":"2026-04-28T11:33:59.062Z","repository":{"id":143666765,"uuid":"419860029","full_name":"simonecorsi/go-declarative-markdown","owner":"simonecorsi","description":"📑  Helps you generate markdown in a declarative way without having to interpolate strings yourself","archived":false,"fork":false,"pushed_at":"2021-10-29T10:30:19.000Z","size":719,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-20T00:34:07.096Z","etag":null,"topics":["declarative","generator","go","golang","markdown","markdown-generator","programmatically"],"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/simonecorsi.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":"2021-10-21T19:57:48.000Z","updated_at":"2021-11-05T15:05:57.000Z","dependencies_parsed_at":"2024-06-20T12:03:40.564Z","dependency_job_id":null,"html_url":"https://github.com/simonecorsi/go-declarative-markdown","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/simonecorsi/go-declarative-markdown","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonecorsi%2Fgo-declarative-markdown","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonecorsi%2Fgo-declarative-markdown/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonecorsi%2Fgo-declarative-markdown/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonecorsi%2Fgo-declarative-markdown/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonecorsi","download_url":"https://codeload.github.com/simonecorsi/go-declarative-markdown/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonecorsi%2Fgo-declarative-markdown/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32379348,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T11:25:28.583Z","status":"ssl_error","status_checked_at":"2026-04-28T11:25:05.435Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["declarative","generator","go","golang","markdown","markdown-generator","programmatically"],"created_at":"2024-10-02T05:11:01.451Z","updated_at":"2026-04-28T11:33:59.043Z","avatar_url":"https://github.com/simonecorsi.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Declarative Markdown\r\n\r\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/simonecorsi/go-declarative-markdown/da5ee95c99a8f17e3f9f5cd2be387807d5f85536/banner.jpg\" alt=\"Declarative Markdown Gopher Logo\"/\u003e\u003c/p\u003e\r\n\r\n## Table of content\r\n\r\n- [declarative markdown](#declarative-markdown)\r\n  - [about](#about)\r\n  - [requirements](#requirements)\r\n  - [installation](#installation)\r\n  - [usage](#usage)\r\n  - [api](#api)\r\n    - [createmarkdown](#createmarkdown)\r\n    - [getline](#getline)\r\n    - [render](#render)\r\n    - [header](#header)\r\n    - [addline](#addline)\r\n    - [paragraph](#paragraph)\r\n    - [quote](#quote)\r\n    - [code](#code)\r\n    - [horizontalline](#horizontalline)\r\n    - [image](#image)\r\n    - [list](#list)\r\n    - [task](#task)\r\n    - [table](#table)\r\n    - [generatetoc](#generatetoc)\r\n  - [contributing](#contributing)\r\n  - [license](#license)\r\n  - [contact](#contact)\r\n\r\n## About\r\n\r\nThis package helps in generating markdown in a declarative way without having to handle strings yourself\r\n\r\n\u003e This README has been generated using this own package!\nYou can see the code example [here](./docs/generator.go)\r\n\r\n## Requirements\r\n\r\n- git\r\n- go 1.16\r\n\r\n## Installation\r\n\r\n```\ngo get github.com/simonecorsi/go-declarative-markdown\n```\r\n\r\n## Usage\r\n\r\n```\npackage main\n\nimport mkd \"github.com/simonecorsi/go-declarative-markdown/markdown\"\n\nfunction main() {\n  md := mkd.CreateMarkdown(\"My h1 Header\")\n  md.Header(\"About\")\n  md.Paragraph(\"Lorem Ipsum\")\n  md.Render() // save to file or whatever\n}\n\n```\r\n\r\n## API\r\n\r\n### CreateMarkdown\r\n\r\n`CreateMarkdown(title string) *Markdown`\r\n\r\nInitialize new Markdown instance with h1 title on top.\r\n\r\n\u003e Returns reference to the Markdown to allow chaining\r\n\r\n### GetLine\r\n\r\n`GetLine(lineNumber int) string`\r\n\r\nUtilities to get a line in the markdown, this is a slice before rendering so LineBreak don't counts\r\n\r\n### Render\r\n\r\n`Render() string`\r\n\r\nRenders all the content add in this markdown instance\r\n\r\n### Header\r\n\r\n`Header(text string, weigth int) *Markdown`\r\n\r\nCreates an heading, you can specify the weigth [1-6]\r\n\r\n\u003e Returns reference to the Markdown to allow chaining\r\n\r\n### AddLine\r\n\r\n`AddLine(text string) *Markdown`\r\n\r\nUtilities that pushes content to the slices of lines, this is used internally by each other command\r\n\r\n\u003e Returns reference to the Markdown to allow chaining\r\n\r\n### Paragraph\r\n\r\n`Paragraph(text string) *Markdown`\r\n\r\nCreate a generic paragraph of text\r\n\r\n\u003e Returns reference to the Markdown to allow chaining\r\n\r\n### Quote\r\n\r\n`Quote(text string) *Markdown`\r\n\r\nCreate quoted paragraph of text\r\n\r\n\u003e Returns reference to the Markdown to allow chaining\r\n\r\n### Code\r\n\r\n`Code(text string, language string) *Markdown`\r\n\r\nCreates a snippet of code with syntax highligh\r\n\r\n\u003e Returns reference to the Markdown to allow chaining\r\n\r\n### HorizontalLine\r\n\r\n`HorizontalLine() *Markdown`\r\n\r\nCreates an horizontal line to dive sections\r\n\r\n\u003e Returns reference to the Markdown to allow chaining\r\n\r\n### Image\r\n\r\n`Image(altText string, filepath string) *Markdown`\r\n\r\nCreates an image with a title\r\n\r\n\u003e Returns reference to the Markdown to allow chaining\r\n\r\n### List\r\n\r\n`List(items []ListItem, numbered bool) *Markdown`\r\n\r\nCreates a list of item, either numbered or with dashes, default to dashes\r\n\r\n\u003e Returns reference to the Markdown to allow chaining\r\n\r\n```\ntype ListItem struct {\n\tLabel string\n\tDepth int\n}\n```\r\n\r\n### Task\r\n\r\n`Task(items []TaskItem, numbered bool) *Markdown`\r\n\r\nCreates a list with checkboxes\r\n\r\n\u003e Returns reference to the Markdown to allow chaining\r\n\r\n```\ntype TaskItem struct {\n\tLabel   string\n\tChecked bool\n}\n```\r\n\r\n### Table\r\n\r\n`Table(headers []string, rows [][]string) *Markdown`\r\n\r\nCreates a table\r\n\r\n\u003e Returns reference to the Markdown to allow chaining\r\n\r\n### GenerateToc\r\n\r\n`GenerateToc(index int) *Markdown`\r\n\r\nCreates table of content and adds it after the main h1 title, call it before rendering!\r\n\r\n## Contributing\r\n\r\nProject is pretty simple and straight forward for what is my needs, but if you have any idea you're welcome.\r\n\r\nThis projects uses [Conventional Commit Format](https://www.conventionalcommits.org) so be sure to use standard commit format or PR won't be accepted\r\n\r\n## License\r\n\r\nDistributed under the MIT License. See `LICENSE` for more information.\r\n\r\n## Contact\r\n\r\nSimone Corsi - [@im_simonecorsi](https://twitter.com/im_simonecorsi)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonecorsi%2Fgo-declarative-markdown","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonecorsi%2Fgo-declarative-markdown","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonecorsi%2Fgo-declarative-markdown/lists"}