{"id":22521787,"url":"https://github.com/ncpa0/termx-markup","last_synced_at":"2026-06-06T21:01:28.852Z","repository":{"id":65380532,"uuid":"586360090","full_name":"ncpa0/termx-markup","owner":"ncpa0","description":"Markup based text formatting for terminal in JavaScript environments.","archived":false,"fork":false,"pushed_at":"2026-04-24T11:03:53.000Z","size":2801,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-04-24T12:34:17.766Z","etag":null,"topics":["ansi","cli","color","console","format","formatter","formatting","html","javascript","markup","nodejs","string","terminal","text","xml"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/ncpa0.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-01-07T21:15:50.000Z","updated_at":"2026-04-24T11:03:26.000Z","dependencies_parsed_at":"2023-09-04T14:27:10.648Z","dependency_job_id":null,"html_url":"https://github.com/ncpa0/termx-markup","commit_stats":null,"previous_names":["ncpa0cpl/termx-markup"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/ncpa0/termx-markup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ncpa0%2Ftermx-markup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ncpa0%2Ftermx-markup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ncpa0%2Ftermx-markup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ncpa0%2Ftermx-markup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ncpa0","download_url":"https://codeload.github.com/ncpa0/termx-markup/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ncpa0%2Ftermx-markup/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33999579,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-06T02:00:07.033Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["ansi","cli","color","console","format","formatter","formatting","html","javascript","markup","nodejs","string","terminal","text","xml"],"created_at":"2024-12-07T05:13:00.050Z","updated_at":"2026-06-06T21:01:28.847Z","avatar_url":"https://github.com/ncpa0.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# termx-markup\n\n![GitHub](https://img.shields.io/github/license/ncpa0cpl/termx-markup?style=for-the-badge)\n![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/ncpa0cpl/termx-markup/test.yml?branch=master\u0026style=for-the-badge)\n[![npm](https://img.shields.io/npm/v/termx-markup?style=for-the-badge)](https://www.npmjs.com/package/termx-markup)\n![Libraries.io dependency status for latest release](https://img.shields.io/librariesio/release/npm/termx-markup?style=for-the-badge)\n![GitHub last commit](https://img.shields.io/github/last-commit/ncpa0cpl/termx-markup?style=for-the-badge)\n\n## Usage\n\n### Print markup\n\n```tsx\nimport { Output, html } from \"termx-markup\";\n\nOutput.setDefaultPrintMethod(console.log); // (optional) print using console.log\n\nconst markup = html`\n  \u003cspan bold color=\"red\"\u003e\n    Hello\n    \u003cpre color=\"blue\"\u003e in my \u003c/pre\u003e\n    world!\n  \u003c/span\u003e\n`;\n\nOutput.println(markup);\n```\n\n#### Output:\n\n![Hello in my World!](./demo/example1.png)\n\n### Only formatting\n\n```tsx\nimport { MarkupFormatter, html } from \"termx-markup\";\n\nconst markup = html`\n  \u003cspan color=\"red\"\u003e\n    Hello\n    \u003cpre color=\"blue\"\u003e in my \u003c/pre\u003e\n    world!\n  \u003c/span\u003e\n`;\n\nconst formatted = MarkupFormatter.format(markup);\n// formatted = \"\\u001b[31mHello \\u001b[34min my\\u001b[0m\\u001b[31m world!\\u001b[0m\"\n\nconsole.log(formatted);\n```\n\n#### Output:\n\n![Hello in my World!](./demo/example2.png)\n\n### Define custom colors\n\n```tsx\nimport { Output, MarkupFormatter, html } from \"termx-markup\";\n\nMarkupFormatter.defineColor(\"burgundy\", \"rgb(128, 0, 32)\");\nMarkupFormatter.defineColor(\"mauve\", \"#E0B0FF\");\nMarkupFormatter.defineColor(\"teal\", { r: 0, g: 128, b: 128 });\n\nconst markup = html`\n  \u003cline color=\"burgundy\"\u003eBurgundy\u003c/line\u003e\n  \u003cline color=\"mauve\"\u003eMauve\u003c/line\u003e\n  \u003cline color=\"teal\"\u003eTeal\u003c/line\u003e\n`;\n\nOutput.print(markup);\n```\n\n#### Output:\n\n![Burgundy, Mauve, Teal](./demo/example3.png)\n\n### Printing lists\n\n```tsx\nimport { Output, html } from \"termx-markup\";\n\nOutput.print(html`\n  \u003cline\u003eDrinks:\u003c/line\u003e\n  \u003cul\u003e\n    \u003cli\u003eCoffee\u003c/li\u003e\n    \u003cli\u003eTea\u003c/li\u003e\n    \u003cli\u003e\n      \u003cline\u003eMilk\u003c/line\u003e\n      \u003cul type=\"circle\"\u003e\n        \u003cli\u003eSkim\u003c/li\u003e\n        \u003cli\u003eWhole\u003c/li\u003e\n      \u003c/ul\u003e\n    \u003c/li\u003e\n  \u003c/ul\u003e\n`);\n```\n\n#### Output:\n\n![Drinks: Coffee Tea Milk Skim Whole](./demo/example4.png)\n\n## Supported tags\n\n- `\u003cspan\u003e` - regular text, trims white-space characters and removes end-line characters\n- `\u003cline\u003e` - same as span, but prints a new line character at the end\n- `\u003cpre\u003e` - preformatted text, all white-space characters will be preserved\n- `\u003cbr /\u003e` - prints a new line character\n- `\u003cs /\u003e` - prints a space character\n- `\u003col\u003e` - ordered list, each child element is required to ba a `\u003cli\u003e` tag\n- `\u003cul\u003e` - unordered list, each child element is required to ba a `\u003cli\u003e` tag, accepts additional attribute `type` (string) which can be of value `circle`, `square` or `bullet` (default is `bullet`)\n- `\u003cpad\u003e` - adds left padding to it's content, accepts attribute `size` (number) which determines the number of spaces to print\n- `\u003cframe\u003e` - adds a border around it's content, possible frame attributes:\n  - `padding=\"\u003cnumber\u003e\"`\n  - `padding-left=\"\u003cnumber\u003e\"`\n  - `padding-right=\"\u003cnumber\u003e\"`\n  - `padding-top=\"\u003cnumber\u003e\"`\n  - `padding-bottom=\"\u003cnumber\u003e\"`\n  - `padding-horizontal=\"\u003cnumber\u003e\"`\n  - `padding-vertical=\"\u003cnumber\u003e\"`\n  - `height=\"\u003cnumber\u003e\"`\n  - `max-height=\"\u003cnumber\u003e\"`\n  - `width=\"\u003cnumber\u003e\"`\n  - `max-width=\"\u003cnumber\u003e\"`\n  - `hcenter` (boolean)\n  - `hend` (boolean)\n  - `vcenter` (boolean)\n  - `vend` (boolean)\n\n## Inline and Block elements\n\nThere are two display types of elements, `inline` and `block`.\n\nInline elements are always rendered next to each other within the same line, if there are any white-spaces between the inline elements it will be replaced with a single space.\n\nBlock elements, start with a line break character, unless the block element is the first one, and end with a line break, unless the block element is the last one.\n\n#### Inline elements:\n\n- `\u003cspan\u003e`\n- `\u003cpre\u003e`\n- `\u003cbr\u003e`\n- `\u003cs\u003e`\n- `\u003cli\u003e`\n\n#### Block elements:\n\n- `\u003cline\u003e`\n- `\u003cframe\u003e`\n- `\u003cpad\u003e`\n- `\u003cul\u003e`\n- `\u003col\u003e`\n\n## Supported attributes\n\nFollowing attributes are available on all tags:\n\n- `color` - color of the text (css-like rgb or a color name)\n- `bg` - background color of the text (css-like rgb or a color name)\n- `bold` - bold text (boolean)\n- `dim` - dimmed text (boolean)\n- `italic` - italic text (boolean)\n- `underscore` - underlined text (boolean)\n- `blink` - blinking text (boolean)\n- `invert` - inverse color text (boolean)\n- `strike` - strike-through text (boolean)\n- `no-inherit` - prevents inheriting parent styles (boolean)\n\n## Default available colors\n\n- `red`\n- `green`\n- `yellow`\n- `blue`\n- `magenta`\n- `cyan`\n- `white`\n- `lightRed`\n- `lightGreen`\n- `lightYellow`\n- `lightBlue`\n- `lightMagenta`\n- `lightCyan`\n- `lightWhite`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fncpa0%2Ftermx-markup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fncpa0%2Ftermx-markup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fncpa0%2Ftermx-markup/lists"}