{"id":17966517,"url":"https://github.com/wingio/syntakts","last_synced_at":"2025-07-31T12:05:37.366Z","repository":{"id":206592268,"uuid":"703049312","full_name":"wingio/syntakts","owner":"wingio","description":"Simple to use text parser and syntax highlighter for Kotlin Multiplatform","archived":false,"fork":false,"pushed_at":"2025-01-29T00:41:05.000Z","size":571,"stargazers_count":25,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-05T05:33:05.772Z","etag":null,"topics":["abstract-syntax-tree","android","android-library","ast","compose","compose-library","compose-multiplatform","hacktoberfest","kmp","kotlin","kotlin-library","kotlin-multiplatform","text-processing"],"latest_commit_sha":null,"homepage":"http://syntakts.wingio.xyz","language":"Kotlin","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/wingio.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},"funding":{"github":"wingio"}},"created_at":"2023-10-10T13:53:59.000Z","updated_at":"2025-01-29T00:41:09.000Z","dependencies_parsed_at":"2024-10-29T13:55:41.134Z","dependency_job_id":null,"html_url":"https://github.com/wingio/syntakts","commit_stats":null,"previous_names":["wingio/syntakts"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/wingio/syntakts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wingio%2Fsyntakts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wingio%2Fsyntakts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wingio%2Fsyntakts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wingio%2Fsyntakts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wingio","download_url":"https://codeload.github.com/wingio/syntakts/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wingio%2Fsyntakts/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268035546,"owners_count":24185055,"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","status":"online","status_checked_at":"2025-07-31T02:00:08.723Z","response_time":66,"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":["abstract-syntax-tree","android","android-library","ast","compose","compose-library","compose-multiplatform","hacktoberfest","kmp","kotlin","kotlin-library","kotlin-multiplatform","text-processing"],"created_at":"2024-10-29T13:10:45.631Z","updated_at":"2025-07-31T12:05:37.337Z","avatar_url":"https://github.com/wingio.png","language":"Kotlin","funding_links":["https://github.com/sponsors/wingio"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"/images/logo.png\" alt=\"Syntakts\" width=\"100%\" /\u003e\n\n  ### Simple to use text parser and syntax highlighter for Kotlin Multiplatform\n  [![Maven Central](https://img.shields.io/maven-central/v/xyz.wingio.syntakts/syntakts-core?style=for-the-badge\u0026logo=apachemaven\u0026label=Latest\u0026labelColor=black\u0026color=blue)](https://central.sonatype.com/namespace/xyz.wingio.syntakts)\n  [![GitHub Repo stars](https://img.shields.io/github/stars/wingio/syntakts?style=for-the-badge\u0026logo=github\u0026labelColor=black\u0026color=red)](https://github.com/wingio/syntakts/stargazers)\n  [![GitHub Sponsors](https://img.shields.io/github/sponsors/wingio?style=for-the-badge\u0026logo=githubsponsors\u0026labelColor=black\u0026color=pink)](https://github.com/sponsors/wingio)\n\n  ---\n\u003c/div\u003e\n\n## Setup\n```kotlin\nimplementation(\"xyz.wingio.syntakts:syntakts-core:$syntaktsVersion\")\n// implementation(\"xyz.wingio.syntakts:syntakts-compose:$syntaktsVersion\")\n// implementation(\"xyz.wingio.syntakts:syntakts-compose-material3:$syntaktsVersion\")\n```\n\n## Use\nSyntakts can be set up through a simple DSL:\n```kotlin\nval mySyntakts = syntakts\u003cUnit\u003e {\n  rule(\"@([A-z])\") { result, context -\u003e\n    append(result.groupValues[1]) {\n      color = Color.Yellow\n    }\n  }\n}\n```\n\nWe also provide MarkdownSyntakts and BasicMarkdownSyntakts, which has some default markdown rules\n\n### Context\nSyntakts allows you to pass any class as context, this can be used to pass additional information for rendering.\nIf you don't need to use context you can set it to Unit\n\nExample:\n```kotlin\ndata class Context(\n  val userMap = mapOf(\"1234\" to \"Wing\")\n)\n\nval mySytankts = syntakts\u003cContext\u003e {\n  rule(\"\u003c@([0-9]+)\u003e\") { result, context -\u003e\n    val username = context.userMap[result.groupValues[1]] ?: \"Unknown\"\n    append(\"@$username\") {\n      color = Color.Yellow\n    }\n  }\n}\n```\n\n## Displaying\n\n### Compose\nArtifact: `syntakts-compose`\n\nSyntakts uses AnnotatedStrings in order to display rendered text in Compose\n\n\u003e [!NOTE]\n\u003e \n\u003e When creating a Syntakts instance in a composable we reccommend replacing `syntakts {}` with `rememberSyntakts {}`\n\nExample: \n```kotlin\n@Composable\nfun SomeScreen() {\n  val syntakts = rememberSyntakts\u003cUnit\u003e { /* */ }\n\n  Text(\n    text = syntakts.rememberRendered(\"some input\")\n  )\n}\n```\n\n### Android\nArtifact: `syntakts-android`\n\nSyntakts uses SpannableStrings in order to display rendered text on Android\n\nExample:\n```kotlin\nval syntakts = syntakts\u003cUnit\u003e { /* */ }\n\nfindViewById\u003cTextView\u003e(R.id.my_text_view).render(\"some input\", syntakts)\n```\n\n#### Clickable\nSyntakts for Compose includes a ClickableText component that is neccessary in order to handle clickable text. The `syntakts-compose-material3` includes this component as well but adds support for Material 3 theming\n\nSyntakts for Android requires that the TextView have its movementMethod set to our ClickableMovementMethod\n\n## Attribution\nSyntakts was heavily inspired by [SimpleAST](https://github.com/discord/SimpleAST), an unfortunately abandoned library that was once used in Discords android app\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwingio%2Fsyntakts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwingio%2Fsyntakts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwingio%2Fsyntakts/lists"}