{"id":48237526,"url":"https://github.com/fezcode/doku.js","last_synced_at":"2026-04-04T20:07:59.818Z","repository":{"id":57857565,"uuid":"527676748","full_name":"fezcode/doku.js","owner":"fezcode","description":"A Simple Text/Document Viewer written in JS","archived":false,"fork":false,"pushed_at":"2022-09-20T18:59:29.000Z","size":822,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-26T15:56:01.305Z","etag":null,"topics":["application","document","documentation","node","nodejs","npm","npm-package","shell","syntax","terminal","tui"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/doku.js","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/fezcode.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":"2022-08-22T17:59:06.000Z","updated_at":"2023-06-02T21:04:44.000Z","dependencies_parsed_at":"2022-08-29T11:01:41.326Z","dependency_job_id":null,"html_url":"https://github.com/fezcode/doku.js","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fezcode/doku.js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fezcode%2Fdoku.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fezcode%2Fdoku.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fezcode%2Fdoku.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fezcode%2Fdoku.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fezcode","download_url":"https://codeload.github.com/fezcode/doku.js/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fezcode%2Fdoku.js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31411912,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T19:29:44.979Z","status":"ssl_error","status_checked_at":"2026-04-04T19:29:11.535Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["application","document","documentation","node","nodejs","npm","npm-package","shell","syntax","terminal","tui"],"created_at":"2026-04-04T20:07:59.152Z","updated_at":"2026-04-04T20:07:59.813Z","avatar_url":"https://github.com/fezcode.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Doku\n\nDoku.js is a terminal ui text/document viewer that supports a custom documentation syntax called `doky`.\n\n![ASCII ART](./images/ascii-art.png)\n\n## Features\n- Border colors. (all common terminal colors: blue, red, green, yellow, magenta, cyan, white, black, results may change depending on your terminal colors)\n- Center content.\n- Change frame position.\n- Slide text from top to bottom.\n- Change common patterns.\n- Text search.\n- App Commands.\n\n### Common Patterns\n\n| Pattern                  | Better Pattern             |\n|--------------------------|----------------------------|\n| Line with 10 or more `-` | `▔` (Heading-like)         | \n| Line with 10 or more `_` | `▁` (Heading-like)         | \n| Line with 10 or more `=` | `═` (Heading-like)         | \n| `==\u003e`                    | `⇒`                        |\n| `\u003c==`                    | `⇐`                       |\n| `--\u003e`                    | `⟶`                        |\n| `\u003c--`                    | `⟵`                        |\n| 8 or more `-`            | `―`                        |\n| 8 or more `_`            | `▁`                        |\n| `:=`                     | `≔`                        |\n| `=:`                     | `≕`                        |\n| `~=`                     | `≈`                        |\n| `!=`                     | `≠`                        |\n\n\u003e Examples are located in `examples/patterns.doxy`\n\n**Results**\n\n![Results of Patters](./images/patterns.png)\n\n## Installation\n\n```bash\nnpm install -g doku.js\n```\n\nYou can then run doku by simply typing `doku \u003cfilename\u003e` on any file you want.\n\nIf you don't want to install it globally, then you can install it in any directory you want\nthen execute it via `npx doku` command.\n\n\n### Using inside another Node app\nIf you want to use this library within your project simply add as dependency.\n```bash\nnpm install doku.js\n```\n\nAfter adding as dependency you can simply `require` it.\n\nExample:\n\n``` js\nconst doku = require(\"doku\");\n\nfunction stopExecution() {\n    process.exit(0);\n}\n\nconst header = \"...\"; // Header string that will be displayed at the top of application.\nconst content = \"...\"; // String containing document.\nconst isCentered = true; // Show frame at center.\n\nconst dokument = new Doku(content, header, isCentered);\ndokument.subToEvent(\"doku-end\", stopExecution);\n```\n\n## Details\n\n### Parsing\nDoku can render any plain text file as it is. It will parse file on the start then will parse again if terminal resizes.\nThis parsing will cause change in total number of lines like shown in below.\n\n#### Parsing on smaller displays\nTotal number of liner increased.\n![Small Display](./images/display-small.png)\n\n#### Parsing on larger displays\nTotal number of liner decreased.\n![Large Display](./images/display-large.png)\n\n### Terminal\n\nDoku clears terminal each time it will do re-rendering. You cannot really access to your terminal since it (stdin) is in raw mode. \n\n```js\nprocess.stdin.setRawMode(true);\nprocess.stdin.setEncoding('utf8');\nprocess.stdin.resume();\n```\n## Events\n\nIf you included `doku` as dependency to your project, then you'll have two events.\n\n### `doku-start` event\n\nThis event will be fired when construction of `doku` object is done.\n```js\n// To subscribe\ndoku.subToEvent(\"doku-start\", startHandler);\n\n// To unsubscribe\ndoku.unsubToEvent(\"doku-start\", startHandler);\n```\n\n### `doku-end` event\n\nThis event will be fired when deconstruction of `doku` object is occurs.\n```js\n// To subscribe\ndoku.subToEvent(\"doku-end\", stopHandler);\n\n// To unsubscribe\ndoku.unsubToEvent(\"doku-end\", stopHandler);\n```\n\n## Actions\n\nDoku has following actions while running application:\n\n| Action                   | Description (all actions are case insensitive)            |\n|--------------------------|-----------------------------------------------------------|\n| Next Line                | d, Down Arrow, Enter                                      |\n| Previous Line            | a, Up Arrow                                               |\n| Next Page (20 lines)     | Page Down, Right Arrow                                    |\n| Previous Page (20 lines) | Page Up, Left Arrow                                       |\n| Go To Start              | s, Home                                                   |\n| Go To End                | e, End                                                    |\n| Go To Line Number        | Print any number. Press Enter to go, q or ESC to cancel   |\n| Cycle Border Colors      | r (blue, red, green, yellow, magenta, cyan, white, black) |\n| Center Content           | c                                                         |\n| Frame Position           | l                                                         |\n| Toggle Text Slide        | t                                                         |\n| Toggle Patterns          | p                                                         |\n| Find Next                | n (Go to next occurrence of word if exists)               |\n| Find Previous            | b (Go to previous occurrence of word if exists)           |\n| Open Command Line        | :                                                         |\n| Show Help Window         | h                                                         |\n| Quit Application         | q or CTRL+C                                               |\n| Quit Help                | h                                                         |\n\n## App Commands\nWhile in normal mode (not in command line), if a number is entered as the first character, command line waits a line number to go. If given line number is valid then document will go to that line. You can always cancel command by pressing `ESC` or `q`.\n\nIf an error occurs, then command line (alongside with status) will turn red.\nFor example if user presses `k` which is not mapped, an error like shown below will be displayed. \n![Error due to not mapped key](./images/error.png)\n\nIf user types `:` then it opens a command line. There are couple of things that users can do:\n\n| Commands | Shortcut | Description                        | Argument Number | Argument Type |\n|----------|----------|------------------------------------|-----------------|---------------|\n| `switch` | `sw`     | switches state of given command    | 1               | Any           |\n| `toggle` | `to`     | toggles given command              | 1               | Any           |\n| `find`   | `f`      | find all occurrences of given text | 1               | Any           |\n| `time`   | `t`      | sets time for text slide           | 1               | Number        |\n| `quit`   | `q`      | quits application                  | 0               | None          |\n\n### Switch Command\n\n| Commands       | Abbr. | Description          | # of Arguments |\n|----------------|-------|----------------------|----------------|\n| `block       ` |       | changes border block | 0              |\n| `border-color` | `bc`  | changes border color | 0              |\n\n### Toggle Command\n\n| Commands     | Abbr. | Description                      | # of Arguments |\n|--------------|-------|----------------------------------|----------------|\n|`same-color`  | `sc`  | set all borders same color       | 0              |\n|`case-ignore` | `ci`  | case sensitivity in find command | 0              |\n\n### \n\n### Time Command\nIt sets the time interval to text slide command. Default is 1000ms (1 second).\nIt takes 1 argument. That argument must be positive number. It is in milliseconds.\n\n### Quit Command\nQuits application.\n\n## Screenshots\n\n#### Search Command\n![Search Command](./images/search-1.png)\n\n#### Searching Next by Pressing `n`\n![Search Next](./images/search-2.png)\n\n#### Frame Left\n![Frame Left](./images/frame-left.png)\n\n#### Frame Center\n![Frame Center](./images/frame-center.png)\n\n#### Content Centered\n![Content Centered](./images/content-center.png)\n\n\n\n# doky - Custom Documentation Syntax\n\n`doky` has custom commands that allows `doku` to change what is displayed on terminal.\n\n## Table\n\nIf you want to display your data in a tabular form, you use following commands:\n\n- `@{begin-table}@`: This command starts table data. Whole line must be `@{begin-table}@` to parse everything correctly.\n- `@{end-table}@`: This command ends table data. Whole line must be `@{end-table}@` to parse everything correctly.\n\nIn between these two lines with command, you need to provide data as below:\n\n```\n| Column | .... | .... | .... |  --\u003e Columns \n|-----------------------------|  --\u003e Separator\n| Row1   | .... | .... | .... |  --\u003e Row\n| Row2   | .... | .... | .... |  --\u003e Row\n```\n\nYou can add `|` character to separator line if you want.\nThere is no left, right or center align.\n\n### Examples\n\n#### Simple\n```\n@{begin-table}@\n| Column 1 | Column 2 | Column 3 |\n|----------|----------|----------|\n| Data 1-1 | Data 1-2 | Data 1-3 | \n| Data 3-1 | Data 3-2 | Data 3-3 |\n@{end-table}@\n```\n\n#### Missing Fields \n```\n@{begin-table}@\n| Column 1 | Column 2 | Column 3 |\n|--------------------------------|\n| Data 1-1 | Data 1-2 |\n| Data 2-1 | | Data 2-3 |\n@{end-table}@\n```\n\n#### More Complex\n```\n@{begin-table}@\n| Column 1 | Column 2 | Column 3 |\n|----------|----------|----------|\n| Data 1-1 | Data 1-2 | Data 1-3 | \n\n| Data 2-1 |\n// Inline comment\n| Data 3-1      | Data 3-2      | Data 3-3       |\n@{end-table}@\n```\n\u003e Examples are located in `examples/tables.doxy`\n\n**Results**\n\n![Results of Table](./images/tables.png)\n\n\n## Code Block\n\nWhen you want to display your text in a code block, multiline or inline, you can use 3 backticks (```)\n\n3 backticks start and end code blocks.\n\n### Examples\n\n#### Inline\nHere is an \\`\\`\\`inline\\`\\`\\` code block.\n\n#### Multiline\n\\`\\`\\`\nHere is a\nmultiline\ncode block.\n\\`\\`\\`\n\n#### Both\nMaybe you want to try \\`\\`\\`\nSomething like a multiline\nand then\n\\`\\`\\`something like \\`\\`\\`inline\\`\\`\\` code block.\n\n\u003e Examples are located in `examples/code-block.doxy`\n\n**Results**\n\n![Results of Table](./images/code-block.png)\n\n## Commands\n`doky` has a command syntax. The syntax is `@{command}@`.\n\nAny command you want to have will be in between command start (`@{`) and command end (`}@`) characters.\n\nYou can put any number of commands in between command start and end characters with comma (`,`) as the delimiter.\n\nIf you want to escape any string in a command block, then simply put it in between quotes (`\"text\"`).\nThis will make that string to be interpreted as plain text.\n\nFor example:\n\n```@{c.fg.white, c.bg.red, \"White on Red\", c.reset}@```\n\nwill put ![Results of Command](./images/commands.png)\n\n## Commands: Coloring\n\nThere are couple of coloring commands.\n\nAll coloring commands start with `c` prefix.\n\n| Command           | Effect                                            |\n|:-----------------:|---------------------------------------------------|\n| `c.reset`         | Resets all coloring effects                       |\n| `c.bright`        | Makes font color bright                           |\n| `c.dim`           | Makes font color dimmer                           |\n| `c.underscore`    | Puts underscore to text                           |\n| `c.blink`         | Makes text blink                                  |\n| `c.reverse`       | Switches back and foreground color as in selected |\n| `c.hidden`        | Makes text hidden                                 |\n| `c.fg.black`      | Black   Foreground                                |\n| `c.fg.red`        | Red     Foreground                                |\n| `c.fg.green`      | Green   Foreground                                |\n| `c.fg.yellow`     | Yellow  Foreground                                |\n| `c.fg.blue`       | Blue    Foreground                                |\n| `c.fg.magenta`    | Magenta Foreground                                |\n| `c.fg.cyan`       | Cyan    Foreground                                |\n| `c.fg.white`      | White   Foreground                                |\n| `c.bg.black`      | Black   Background                                |\n| `c.bg.red`        | Red     Background                                |\n| `c.bg.green`      | Green   Background                                |\n| `c.bg.yellow`     | Yellow  Background                                |\n| `c.bg.blue`       | Blue    Background                                |\n| `c.bg.magenta`    | Magenta Background                                |\n| `c.bg.cyan`       | Cyan    Background                                |\n| `c.bg.white`      | White   Background                                |\n| `c.header`        | Blue background + Black Foreground                |\n| `c.warning`       | Black background + Yellow Foreground              |\n\n\u003e Examples are located in `examples/colors.doxy`\n\n**Results**\n\n![Results of Colors](./images/colors.png)\n\n\n## Commands: Extras\n\n### `shrug`\n\nThis command puts `¯\\_(ツ⁣)_/¯` into where you put the command.\n\n### `startdate`\n\nThis command puts start date time of the application into where you put the command.\n\n### Escaping Commands\n\nIf you ever find yourself in need of escaping certain commands, like in documentation, you can use \n```\n@{\"@{escaped}@\"}@\n```\n\n`\"@{not escaped}@\"` will not be escaped since `@{` and `}@` will be parsed. However, `@{\"@{finally escaped}@\"}@` will be escaped.\n\n\u003e Examples are located in `examples/extras.doxy`\n\n**Results**\n\n![Results of Extras](./images/extras.png)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffezcode%2Fdoku.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffezcode%2Fdoku.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffezcode%2Fdoku.js/lists"}