{"id":16658097,"url":"https://github.com/leandrocp/autumn","last_synced_at":"2025-04-06T11:07:28.740Z","repository":{"id":196677317,"uuid":"694845336","full_name":"leandrocp/autumn","owner":"leandrocp","description":"Syntax highlighter powered by Tree-sitter and Neovim themes.","archived":false,"fork":false,"pushed_at":"2025-03-15T20:24:37.000Z","size":18320,"stargazers_count":71,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-04T12:12:51.912Z","etag":null,"topics":["elixir","rust","syntax-highlighter","syntax-highlighting","tree-sitter"],"latest_commit_sha":null,"homepage":"https://autumnus.dev","language":"CSS","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/leandrocp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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":"2023-09-21T20:15:37.000Z","updated_at":"2025-03-31T00:56:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"ba5af968-71c9-40a0-9c1e-15c92f9e77be","html_url":"https://github.com/leandrocp/autumn","commit_stats":{"total_commits":107,"total_committers":2,"mean_commits":53.5,"dds":0.009345794392523366,"last_synced_commit":"2eb22d6f9673fadb6ee93c193289171e25b544f4"},"previous_names":["leandrocp/autumn"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leandrocp%2Fautumn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leandrocp%2Fautumn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leandrocp%2Fautumn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leandrocp%2Fautumn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leandrocp","download_url":"https://codeload.github.com/leandrocp/autumn/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247471517,"owners_count":20944158,"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":["elixir","rust","syntax-highlighter","syntax-highlighting","tree-sitter"],"created_at":"2024-10-12T10:03:12.303Z","updated_at":"2025-04-06T11:07:28.718Z","avatar_url":"https://github.com/leandrocp.png","language":"CSS","funding_links":[],"categories":["CSS"],"sub_categories":[],"readme":"# Autumn\n\n\u003c!-- MDOC --\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/leandrocp/autumn/main/assets/images/autumn_logo.png\" width=\"512\" alt=\"Autumn logo\"\u003e\n\u003c/div\u003e\n\n\u003cp align=\"center\"\u003e\n  Syntax highlighter powered by Tree-sitter and Neovim themes.\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://autumnus.dev\"\u003ehttps://autumnus.dev\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://hex.pm/packages/autumn\"\u003e\n    \u003cimg alt=\"Hex Version\" src=\"https://img.shields.io/hexpm/v/autumn\"\u003e\n  \u003c/a\u003e\n\n  \u003ca href=\"https://hexdocs.pm/autumn\"\u003e\n    \u003cimg alt=\"Hex Docs\" src=\"http://img.shields.io/badge/hex.pm-docs-green.svg?style=flat\"\u003e\n  \u003c/a\u003e\n\n  \u003ca href=\"https://opensource.org/licenses/MIT\"\u003e\n    \u003cimg alt=\"MIT\" src=\"https://img.shields.io/hexpm/l/autumn\"\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n## Features\n\n- 🌳 60+ languages with tree-sitter parsing\n- 🎨 100+ Neovim themes\n- 📝 HTML output with inline or linked styles\n- 🖥️ Terminal output with ANSI colors\n- 🔍 Language auto-detection\n- 🎯 Customizable formatting options\n\n## Installation\n\n```elixir\ndef deps do\n  [\n    {:autumn, \"~\u003e 0.3\"}\n  ]\nend\n```\n\n## Usage\n\n### Basic Usage (HTML Inline)\n\n```elixir\niex\u003e Autumn.highlight!(\"Atom.to_string(:elixir)\", language: \"elixir\")\n~s|\u003cpre class=\"athl\" style=\"color: #abb2bf; background-color: #282c34;\"\u003e\u003ccode class=\"language-elixir\" translate=\"no\" tabindex=\"0\"\u003e\u003cspan class=\"line\" data-line=\"1\"\u003e\u003cspan style=\"color: #e5c07b;\"\u003eAtom\u003c/span\u003e\u003cspan style=\"color: #56b6c2;\"\u003e.\u003c/span\u003e\u003cspan style=\"color: #61afef;\"\u003eto_string\u003c/span\u003e\u003cspan style=\"color: #c678dd;\"\u003e(\u003c/span\u003e\u003cspan style=\"color: #e06c75;\"\u003e:elixir\u003c/span\u003e\u003cspan style=\"color: #c678dd;\"\u003e)\u003c/span\u003e\n\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e|\n```\n\nSee the HTML Linked and Terminal formatters below for more options.\n\n### Language Auto-detection\n\n```elixir\niex\u003e Autumn.highlight!(\"#!/usr/bin/env bash\\nID=1\")\n~s|\u003cpre class=\"athl\" style=\"color: #abb2bf; background-color: #282c34;\"\u003e\u003ccode class=\"language-bash\" translate=\"no\" tabindex=\"0\"\u003e\u003cspan class=\"line\" data-line=\"1\"\u003e\u003cspan style=\"color: #c678dd;\"\u003e#!/usr/bin/env bash\u003c/span\u003e\n\u003c/span\u003e\u003cspan class=\"line\" data-line=\"2\"\u003e\u003cspan style=\"color: #d19a66;\"\u003eID\u003c/span\u003e\u003cspan style=\"color: #56b6c2;\"\u003e=\u003c/span\u003e\u003cspan style=\"color: #d19a66;\"\u003e1\u003c/span\u003e\n\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e|\n```\n\n### Themes\n\nThemes can be specified either by name or by using a theme struct:\n\n```elixir\n# Using theme name\niex\u003e Autumn.highlight!(\"setTimeout(fun, 5000);\", language: \"js\", theme: \"github_light\")\n~s|\u003cpre class=\"athl\" style=\"color: #1f2328; background-color: #ffffff;\"\u003e\u003ccode class=\"language-javascript\" translate=\"no\" tabindex=\"0\"\u003e\u003cspan class=\"line\" data-line=\"1\"\u003e\u003cspan style=\"color: #6639ba;\"\u003esetTimeout\u003c/span\u003e\u003cspan style=\"color: #1f2328;\"\u003e(\u003c/span\u003e\u003cspan style=\"color: #1f2328;\"\u003efun\u003c/span\u003e\u003cspan style=\"color: #1f2328;\"\u003e,\u003c/span\u003e \u003cspan style=\"color: #0550ae;\"\u003e5000\u003c/span\u003e\u003cspan style=\"color: #1f2328;\"\u003e)\u003c/span\u003e\u003cspan style=\"color: #1f2328;\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e|\n\n# Using theme struct\niex\u003e theme = Autumn.Theme.get(\"github_light\")\niex\u003e Autumn.highlight!(\"setTimeout(fun, 5000);\", language: \"js\", theme: theme)\n```\n\n## Incomplete or Malformed code\n\nIt's also capable of handling incomplete or malformed code, useful for streaming like in a ChatGPT interface:\n\n```elixir\niex\u003e Autumn.highlight!(\"const header = document.getEl\", language: \"js\")\n~s|\u003cpre class=\"athl\" style=\"color: #abb2bf; background-color: #282c34;\"\u003e\u003ccode class=\"language-javascript\" translate=\"no\" tabindex=\"0\"\u003e\u003cspan class=\"line\" data-line=\"1\"\u003e\u003cspan style=\"color: #c678dd;\"\u003econst\u003c/span\u003e \u003cspan style=\"color: #abb2bf;\"\u003eheader\u003c/span\u003e \u003cspan style=\"color: #abb2bf;\"\u003e=\u003c/span\u003e \u003cspan style=\"color: #e86671;\"\u003edocument\u003c/span\u003e\u003cspan style=\"color: #848b98;\"\u003e.\u003c/span\u003e\u003cspan style=\"color: #56b6c2;\"\u003egetEl\u003c/span\u003e\n\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e|\n```\n\n## Formatters\n\nAutumn supports three output formatters:\n\nBoth HTML formatters wrap each line in a `\u003cspan class=\"line\"\u003e` element with a `data-line` attribute containing the line number, making it easy to add line numbers or implement line-based features in your application.\n\n### HTML Inline (Default)\n\nGenerates HTML with inline styles for each token:\n\n```elixir\niex\u003e Autumn.highlight!(\"Atom.to_string(:elixir)\", language: \"elixir\", formatter: :html_inline)\n# or with options\niex\u003e Autumn.highlight!(\"Atom.to_string(:elixir)\", language: \"elixir\", formatter: {:html_inline, pre_class: \"my-code\", italic: true, include_highlights: true})\n```\n\nOptions:\n- `:pre_class` - CSS class for the `\u003cpre\u003e` tag\n- `:italic` - enable italic styles\n- `:include_highlights` - include highlight scope names in `data-highlight` attributes\n\n### HTML Linked\n\nGenerates HTML with CSS classes for styling:\n\n```elixir\niex\u003e Autumn.highlight!(\"Atom.to_string(:elixir)\", language: \"elixir\", formatter: :html_linked)\n# or with options\niex\u003e Autumn.highlight!(\"Atom.to_string(:elixir)\", language: \"elixir\", formatter: {:html_linked, pre_class: \"my-code\"})\n```\n\nOptions:\n- `:pre_class` - CSS class for the `\u003cpre\u003e` tag\n\nTo use linked styles, you need to include one of the [available CSS themes](https://github.com/leandrocp/autumn/tree/main/priv/static/css) in your app.\n\nFor Phoenix apps, add this to your `endpoint.ex`:\n\n```elixir\nplug Plug.Static,\n  at: \"/themes\",\n  from: {:autumn, \"priv/static/css/\"},\n  only: [\"dracula.css\"] # choose any theme you want\n```\n\nThen add the stylesheet to your template:\n\n```html\n\u003clink phx-track-static rel=\"stylesheet\" href={~p\"/themes/dracula.css\"} /\u003e\n```\n\n### Terminal\n\nGenerates ANSI escape codes for terminal output:\n\n```elixir\niex\u003e Autumn.highlight!(\"Atom.to_string(:elixir)\", language: \"elixir\", formatter: :terminal)\n# or with options\niex\u003e Autumn.highlight!(\"Atom.to_string(:elixir)\", language: \"elixir\", formatter: {:terminal, italic: true})\n```\n\nOptions:\n- `:italic` - enable italic styles (if supported by your terminal)\n\n## Themes\n\nUse `Autumn.available_themes/0` to list all available themes and `Autumn.Theme.get/1` to get a specific theme. Themes are sourced from popular Neovim colorschemes.\n\n## Samples\n\nVisit https://autumnus.dev to check out some examples.\n\n## Looking for help with your Elixir project?\n\n\u003cimg src=\"https://raw.githubusercontent.com/leandrocp/autumn/main/assets/images/dockyard_logo.png\" width=\"256\" alt=\"DockYard logo\"\u003e\n\nAt DockYard we are [ready to help you build your next Elixir project](https://dockyard.com/phoenix-consulting).\nWe have a unique expertise in Elixir and Phoenix development that is unmatched and we love to [write about Elixir](https://dockyard.com/blog/categories/elixir).\n\nHave a project in mind? [Get in touch](https://dockyard.com/contact/hire-us)!\n\n## Acknowledgements\n\n* [Logo](https://www.flaticon.com/free-icons/fall) created by by pongsakornRed - Flaticon\n* [Logo font](https://fonts.google.com/specimen/Sacramento) designed by [Astigmatic](http://www.astigmatic.com)\n* [Makeup](https://hex.pm/packages/makeup) for setting up the baseline and for the inspiration\n* [Inkjet](https://crates.io/crates/inkjet) for the Rust implementation up to v0.2 and for the inspiration\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleandrocp%2Fautumn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleandrocp%2Fautumn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleandrocp%2Fautumn/lists"}