{"id":20121435,"url":"https://github.com/reliqarts/go-docweaver","last_synced_at":"2026-04-10T11:02:01.398Z","repository":{"id":57662036,"uuid":"427579323","full_name":"reliqarts/go-docweaver","owner":"reliqarts","description":"Product documentation generation package for Go.","archived":false,"fork":false,"pushed_at":"2024-01-17T17:05:15.000Z","size":39,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-13T07:24:39.580Z","etag":null,"topics":["documentation","docweaver","gin","golang","golang-package","markdown"],"latest_commit_sha":null,"homepage":"https://reliqarts.com/docs/docweaver","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/reliqarts.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-11-13T05:38:17.000Z","updated_at":"2021-12-18T17:30:48.000Z","dependencies_parsed_at":"2024-01-17T18:41:47.102Z","dependency_job_id":"148cf009-1831-4d00-ab68-02d9c52ceb99","html_url":"https://github.com/reliqarts/go-docweaver","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reliqarts%2Fgo-docweaver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reliqarts%2Fgo-docweaver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reliqarts%2Fgo-docweaver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reliqarts%2Fgo-docweaver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reliqarts","download_url":"https://codeload.github.com/reliqarts/go-docweaver/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241564950,"owners_count":19983043,"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":["documentation","docweaver","gin","golang","golang-package","markdown"],"created_at":"2024-11-13T19:29:06.237Z","updated_at":"2025-12-31T01:05:14.002Z","avatar_url":"https://github.com/reliqarts.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docweaver (Go)\n\nAn easy-to-use product documentation package in Golang.\n\nDocweaver is suitable for product documentation and/or knowledge bases. Converts folder(s) of .md files into full-bread\ncomplete documentation. This package is without UI elements and templates, all freedom regarding final presentation is\ngiven to the end-user.\n\nPHP/Laravel version is available [here](https://github.com/reliqarts/laravel-docweaver).\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/reliqarts/go-docweaver.svg)](https://pkg.go.dev/github.com/reliqarts/go-docweaver)\n[![Build Status](https://github.com/reliqarts/go-docweaver/workflows/CI/badge.svg)](https://github.com/reliqarts/go-docweaver/actions?query=workflow:CI)\n[![codecov](https://codecov.io/gh/reliqarts/go-docweaver/branch/main/graph/badge.svg?token=MmlJXECSRF)](https://codecov.io/gh/reliqarts/go-docweaver)\n[![https://goreportcard.com/report/github.com/reliqarts/go-docweaver](https://goreportcard.com/badge/github.com/reliqarts/go-docweaver)](https://goreportcard.com/report/github.com/reliqarts/go-docweaver)\n[![Maintainability](https://api.codeclimate.com/v1/badges/6acc07155660d6ef5468/maintainability)](https://codeclimate.com/github/reliqarts/go-docweaver/maintainability)\n\n---\n\n## Installation \u0026 Usage\n\n### Installation\n\n```bash\ngo get github.com/reliqarts/go-docweaver\n```\n\n### Setup\n\nExample .env:\n\n```dotenv\nDW_DOCS_DIR=./tmp/docs               # Where documentation repos (archives) should be stored.\nDW_ASSETS_DIR=./tmp/doc-assets       # Where documentation assets should be accessed from.\nDW_ROUTE_PREFIX=docs                 # Documentation route prefix.\nDW_ASSETS_ROUTE_PREFIX=doc-assets    # Route prefix for assets.\nDW_SOURCES_FILE=./doc-sources.yml    # Sources file location.\nDW_SHOW_LOGS=true                    # Whether logs should be printed.\n```\n\nExample files:\n- [doc-sources.yml](https://github.com/reliqarts/go-docweaver/blob/main/testdata/doc-sources.yml)\n\n#### Documentation Directory\n\nThe documentation directory is the place where you put your project documentation directories. It may be changed with\nthe environment variable `DW_DOCS_DIR`. The default documentation directory is `./tmp/docs`.\n\n#### Structure\n\nEach project directory should contain separate folders for each documented version. Each version must have at least\ntwo (2) markdown files, namely `documentation.md` and `installation.md`, which serve as the index (usually shown in sidebar) and initial\ndocumentation pages respectively.\n\n```\n[doc dir]\n    │\n    └─── Project One\n    │       └── 1.0 \n    │       └── 2.1\n    │            └── .docweaver.yml       # meta file (optional)\n    │            └── documentation.md     # sidebar nav\n    │            └── installation.md      # initial page\n    │\n    └─── Project Two\n```\n\n#### Meta File\n\nConfigurations for each doc version may be placed in `.docweaver.yml`. The supported settings are:\n\n- #### name\n  Product name.\n- #### description\n  Product description.\n- #### image_url\n  Product image url. This may be an absolute url (e.g. `http://mywebsite.com/myimage.jpg`) or an image found in\n  the `images` resource directory.\n\n  To use the `foo.jpg` in the `images` directory you would set `image_url` to `{{docs}}/images/foo.jpg`.\n\n\n### Usage\n\n\u003cdetails\u003e\n\u003csummary\u003eGin Example\u003c/summary\u003e\n\n###### main.go\n\n```go\npackage main\n\nimport (\n\t\"github.com/gin-gonic/gin\"\n\t\"github.com/reliqarts/go-docweaver\"\n)\n\nfunc main() {\n\trouter := gin.New()\n\n\trouter.GET(docweaver.GetRoutePrefix(), handlers.Documentation())\n\trouter.GET(fmt.Sprintf(\"%s/*path\", docweaver.GetRoutePrefix()), handlers.Documentation())\n\trouter.Static(docweaver.GetAssetsRoutePrefix(), docweaver.GetAssetsDir())\n\n\t_ = (router).Run(\"localhost:8080\")\n}\n\n// ...\n```\n\n###### handlers.go\n\n```go\npackage handlers\n\nimport (\n\t\"github.com/gin-gonic/gin\"\n\t\"github.com/reliqarts/go-docweaver\"\n\t\"net/http\"\n)\n\n// ...\n\nfunc Documentation() gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tpath := c.Param(\"path\")\n\t\tdw := docweaver.GetRepository(\"\")\n\n\t\tif path == \"/\" || path == \"\" {\n\t\t\tproducts, err := dw.FindAllProducts()\n\t\t\tif err != nil {\n\t\t\t\tc.HTML(code, \"error.gohtml\", gin.H{\n\t\t\t\t\t\"errorCode\":    http.StatusInternalServerError,\n\t\t\t\t\t\"errorMessage\": err,\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tc.HTML(http.StatusOK, \"docs/index.gohtml\", gin.H{\n\t\t\t\t\"products\": products,\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\tproductKey, version, pagePath := \"\", \"\", \"\"\n\t\tpageParts := strings.Split(path, \"/\")\n\t\tif len(pageParts) \u003e= 2 {\n\t\t\tproductKey = pageParts[1]\n\t\t}\n\t\tif len(pageParts) \u003e= 3 {\n\t\t\tversion = pageParts[2]\n\t\t}\n\t\tif len(pageParts) \u003e= 4 {\n\t\t\tpagePath = pageParts[3]\n\t\t}\n\n\t\tpage, err := dw.GetPage(productKey, version, pagePath)\n\t\tif err != nil {\n\t\t\terrMsg := fmt.Sprintf(\"Page not found. %s\", err)\n\t\t\tc.HTML(http.StatusNotFound, \"error.gohtml\", gin.H{\n\t\t\t\t\"errorCode\":    http.StatusNotFound,\n\t\t\t\t\"errorMessage\": errMsg,\n\t\t\t})\n\t\t\tc.Abort()\n\t\t\treturn\n\t\t}\n\n\t\tc.HTML(http.StatusOK, \"documentation/show.gohtml\", gin.H{\n\t\t\t\"page\": page,\n\t\t})\n\t}\n}\n\n// ...\n```\n\n\u003c/details\u003e\n\n---\n\n:beers: cheers\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freliqarts%2Fgo-docweaver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freliqarts%2Fgo-docweaver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freliqarts%2Fgo-docweaver/lists"}