{"id":13846764,"url":"https://github.com/liushuping/ascii-tree","last_synced_at":"2025-04-30T22:32:29.715Z","repository":{"id":18639715,"uuid":"21846201","full_name":"liushuping/ascii-tree","owner":"liushuping","description":"A node module for generating tree structure in ASCII","archived":false,"fork":false,"pushed_at":"2016-05-12T08:29:22.000Z","size":30,"stargazers_count":37,"open_issues_count":1,"forks_count":10,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-03T10:34:14.248Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://blog.liushuping.com/ascii-tree/","language":"JavaScript","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/liushuping.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}},"created_at":"2014-07-15T04:28:01.000Z","updated_at":"2024-06-03T04:13:29.000Z","dependencies_parsed_at":"2022-09-15T01:33:51.613Z","dependency_job_id":null,"html_url":"https://github.com/liushuping/ascii-tree","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/liushuping%2Fascii-tree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liushuping%2Fascii-tree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liushuping%2Fascii-tree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liushuping%2Fascii-tree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/liushuping","download_url":"https://codeload.github.com/liushuping/ascii-tree/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224225185,"owners_count":17276435,"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":[],"created_at":"2024-08-04T18:00:46.831Z","updated_at":"2024-11-12T06:12:34.125Z","avatar_url":"https://github.com/liushuping.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":["Require bundler"],"readme":"ascii-tree\n==========\n\nA node module for generating a text tree in ASCII\n\n[![build status](https://travis-ci.org/liushuping/ascii-tree.svg)](https://travis-ci.org/liushuping/ascii-tree.svg)\n\nThis module generates an ascii tree representation for a given string bullet list.\n\n## Generate for a given string bullet list.\n```javascript\nvar asciitree = require('ascii-tree');\nvar input = '#root node\\r\\n##node1\\r\\n###\\r\\nnode1\\r\\n##node2';\nvar tree = asciitree.generate(input);\n```\nthe output string `tree` will be in below representation\n```\nroot node\n├─ node1\n│  └─ node11\n└─ node2\n```\nThe leading character is not necessary to be `#`, but can be any character, this is helpful to resolve the confliction between the leading character and actual content character.\n```javascript\nvar asciitree = require('ascii-tree');\nvar input = '*root node\\r\\n**node1\\r\\n***\\r\\nnode1\\r\\n**node2';\nvar tree = asciitree.generate(input);\n```\nThe line break characters `\\r\\n` are required. \n\n## Generate from an input file\nFirst prepare an input file using bullets representating a tree\n```\n#root node\n##node1\n###node11\n##node2\n```\nagain, the leading character is not necessary to be `#` but can be any character. Then process the file content with ascii-tree to generate the ascii tree\n```javascript\nvar fs = require('fs');\nvar asciitree = require('ascii-tree');\nvar str = fs.readFileSync('input.txt', 'utf8');\nvar tree = asciitree.generate(str);\nfs.writeFile('output.txt', tree, 'utf8');\n```\n\n## Test\nMake sure `mocha` is installed globally\n```\nnpm install mocha -g\n```\nRun `npm test` to run unit test\n## Dependencies\nascii-tree uses [freetree](https://github.com/liushuping/freetree) for creating tree data structure from inputting text\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliushuping%2Fascii-tree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliushuping%2Fascii-tree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliushuping%2Fascii-tree/lists"}