{"id":21331429,"url":"https://github.com/eibens/ansiml","last_synced_at":"2026-05-05T22:34:55.187Z","repository":{"id":62422127,"uuid":"375647812","full_name":"eibens/ansiml","owner":"eibens","description":"AnsiML is a markup language for ANSI colors in TypeScript for Deno.","archived":false,"fork":false,"pushed_at":"2023-05-22T00:13:55.000Z","size":68,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-22T13:47:59.774Z","etag":null,"topics":["ansi","colors","deno","formatting","markup-language","terminal","typescript"],"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/eibens.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-06-10T09:47:18.000Z","updated_at":"2023-05-19T22:34:26.000Z","dependencies_parsed_at":"2024-11-22T00:01:59.295Z","dependency_job_id":null,"html_url":"https://github.com/eibens/ansiml","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eibens%2Fansiml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eibens%2Fansiml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eibens%2Fansiml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eibens%2Fansiml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eibens","download_url":"https://codeload.github.com/eibens/ansiml/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243809849,"owners_count":20351407,"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":["ansi","colors","deno","formatting","markup-language","terminal","typescript"],"created_at":"2024-11-21T22:33:05.870Z","updated_at":"2026-05-05T22:34:55.122Z","avatar_url":"https://github.com/eibens.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [AnsiML] - Markup Language for ANSI Colors\n\nAnsiML is a library for inserting [ANSI Colors] into strings, implemented in\nTypeScript for [Deno]. Text and colors are strictly separated, thus enabling\nsemantic operations on ANSI colored text and rendering to different output\nformats.\n\n[![License][license-shield]](LICENSE) [![Deno doc][deno-doc-shield]][deno-doc]\n[![Deno module][deno-land-shield]][deno-land]\n[![Github tag][github-shield]][github] [![Build][build-shield]][build]\n[![Code coverage][coverage-shield]][coverage]\n\n[github]: https://github.com/eibens/ansiml\n[github-shield]: https://img.shields.io/github/v/tag/eibens/ansiml?label\u0026logo=github\n[coverage-shield]: https://img.shields.io/codecov/c/github/eibens/ansiml?logo=codecov\u0026label\n[license-shield]: https://img.shields.io/github/license/eibens/ansiml?color=informational\n[coverage]: https://codecov.io/gh/eibens/ansiml\n[build]: https://github.com/eibens/ansiml/actions/workflows/ci.yml\n[build-shield]: https://img.shields.io/github/actions/workflow/status/eibens/ansiml/ci.yml?branch=main\n[deno-doc]: https://doc.deno.land/https/deno.land/x/ansiml/mod.ts\n[deno-doc-shield]: https://img.shields.io/badge/doc-informational?logo=deno\n[deno-land]: https://deno.land/x/ansiml\n[deno-land-shield]: https://img.shields.io/badge/x/ansiml-informational?logo=deno\u0026label\n\n# Introduction\n\n[ANSI colors] are character codes for adding colors to console output. Yet, once\nthe color codes are mixed with the text, operations on the text become\ndifficult. Consider these scenarios:\n\n- We want to print colored text with a maximum of 80 columns. If we do not\n  handle the color codes while calculating the positions of the line breaks, the\n  lines will end up shorter than they need to be.\n\n- We want to print syntax-highlighted source code with colored line numbers to\n  the console. Inserting the line numbers into the source might break the parser\n  of the syntax highlighter. Inserting the line numbers after syntax\n  highlighting might overwrite the colors of the highlighted code.\n\n[AnsiML] solves this with an intermediate representation that keeps color codes\nseparate from the actual text. It represents colored text as a tree of terminal\nstring values and non-terminal node objects. Each node object can have a\nsequence of color commands, allowing for hierarchical styling of the text. See\nthe [examples](./examples/) folder for more.\n\n# Features\n\n- Rendering to ANSI colored text, HTML, or plain text.\n- JSX runtime for using JSX syntax to create AnsiML trees.\n- Generic `stringify` function for custom commands and output formats.\n- High-level `Styled` component for nicer dev experience.\n\n# Note on jsx-runtime\n\nThe modern way of configuring JSX is via the `jsxImportSource` compiler option,\nspecified either in the `compilerOptions` section or as a pragma comment. This\ncan be an URL or bare specifier (defined in an import map). TypeScript will then\nappend `/jsx-runtime` to this specifier and try to import it as a module. This\nmodule is expected to export the JSX related functions, such as `jsx`, `jsxs`,\nand `Fragment`.\n\nUnfortunately, Deno will fail to interpret a module named `jsx-runtime` as a\nTypeScript module because it does not end in `.ts` or `.tsx`. The workaround is\nto host the module on a CDN that serves the module with the correct MIME type.\nIn order to run the examples in the repository locally, use\n`deno run -A server.ts`.\n\nAs of May 2023, [https://deno.land/x/](https://deno.land/x/) does not serve the\nmodule with the correct MIME type. Use the legacy configuration via `jsxFactory`\nand `jsxFragmentFactory` or the pragma comments `@jsx` and `@jsxFrag` instead.\nImport `h` and `Fragment` from [mod.ts]. Wait until\n[this issue](https://github.com/denoland/dotland/issues/2212) is resolved.\n\n\u003c!-- links --\u003e\n\n[AnsiML]: #\n[mod.ts]: mod.ts\n[ansi.ts]: ansi.ts\n[ANSI colors]: https://en.wikipedia.org/wiki/ANSI_escape_code\n[Deno]: https://deno.land/\n[ANSI colors module]: https://deno.land/std/fmt/colors.ts\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feibens%2Fansiml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feibens%2Fansiml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feibens%2Fansiml/lists"}