{"id":18020907,"url":"https://github.com/edubart/nldoc","last_synced_at":"2026-01-23T03:57:24.437Z","repository":{"id":139040387,"uuid":"376071680","full_name":"edubart/nldoc","owner":"edubart","description":"Tool to generate documentation for Nelua source files.","archived":false,"fork":false,"pushed_at":"2021-12-11T17:17:47.000Z","size":33,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-02-16T03:41:21.296Z","etag":null,"topics":["documentation","documentation-generator","documentation-tool","lua","nelua"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/edubart.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-06-11T15:43:03.000Z","updated_at":"2024-03-11T13:49:48.000Z","dependencies_parsed_at":"2023-05-11T23:55:11.952Z","dependency_job_id":null,"html_url":"https://github.com/edubart/nldoc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edubart%2Fnldoc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edubart%2Fnldoc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edubart%2Fnldoc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edubart%2Fnldoc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/edubart","download_url":"https://codeload.github.com/edubart/nldoc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248610409,"owners_count":21132920,"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","documentation-generator","documentation-tool","lua","nelua"],"created_at":"2024-10-30T06:08:15.492Z","updated_at":"2026-01-23T03:57:19.406Z","avatar_url":"https://github.com/edubart.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NLDoc - Nelua Documentation Generator\n\nThis is tool to generate documentation for\n[Nelua](https://github.com/edubart/nelua-lang) source files.\n\nThis library was created mainly to generate documentation for the Nelua\nstandard libraries,\nbut it can also be used to generate documentation for other projects,\nthough you may have to personalize or configure it for your needs.\n\nThis library is theoretically easy to hack in case needed,\nit's just a single lua script, comments, and it does not\ndepend on anything other than [LPegRex](https://github.com/edubart/lpegrex) and Lua.\n\nIt contains the whole Nelua grammar definition inside,\ntheoretically this library could also be used to generate documentation for Lua sources,\nbecause the Nelua grammar is a super-set of the Lua grammar.\n\n## How it works\n\nThis library parses a source file twice,\nthe first parse outputs the complete AST for source file.\nA second parse collects all line comments.\nAfter both AST and comments are parsed, all AST nodes are\nvisited while collecting comments just before the AST node.\nJust variable declarations and function definitions are considered for documentation.\nLocal symbols and variables are ignored in the documentation,\nunless you optionally force a name to be included.\nFinally documentation is emitted for filtered AST nodes using\na markdown template with gathered code and comment information,\nthis template can be customized.\n\nThe library design resembles how the Nelua compiler works internally,\nbut in a very simple manner, because like the Nelua compiler it has\na parser made in LPegRex, a visitor pattern to traverse the AST nodes,\nand a generator to emit text, but here we emit documentation\ninstead of C code.\n\n## Complex Example\n\nThe\n[nelua-docs.lua](https://github.com/edubart/nldoc/blob/master/nelua-docs.lua) file\nis used to generate documentation for in the Nelua website, specifically the\n[libraries](https://nelua.io/libraries/)\nand\n[C libraries](https://nelua.io/clibraries/) pages.\n\nHere is a quick how to generate that documentation:\n\n```bash\ngit clone https://github.com/edubart/nelua-lang.git\ngit clone https://github.com/edubart/nldoc.git \u0026\u0026 cd nldoc\nlua nelua-docs.lua ../nelua-lang\n```\n\nThis requires Lua 5.4 and LPegRex to be installed, alternatively\nyou can run with `nelua --script`, as Nelua compiler comes with Lua 5.4 and LPegRex bundled:\n\n```bash\nnelua --script nelua-docs.lua ../nelua-lang\n```\n\nIt will generate documentation according to the rules defined in `nelua-docs.lua`,\nread the file to understand how it works.\n\n## Small Example\n\nThe [example folder](https://github.com/edubart/nldoc/blob/master/example/)\ncontains a simple example on how to generate documentation for a small library:\n\n- [example/person.nelua](https://github.com/edubart/nldoc/blob/master/example/person.nelua) the source file that will be parsed and documented.\n- [example/person-docs.lua](https://github.com/edubart/nldoc/blob/master/example/person-docs.lua) a lua script that generates the documentation.\n- [example/person.md](https://github.com/edubart/nldoc/blob/master/example/person.md) the generated documentation output in Markdown format.\n\nTo regenerate `example/person.md` run the following:\n\n```bash\nnelua --script example/person-docs.lua\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedubart%2Fnldoc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedubart%2Fnldoc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedubart%2Fnldoc/lists"}