{"id":16526114,"url":"https://github.com/markusressel/kodeeditor","last_synced_at":"2025-07-30T05:05:16.033Z","repository":{"id":37627907,"uuid":"146120522","full_name":"markusressel/KodeEditor","owner":"markusressel","description":"A simple code editor with syntax highlighting and pinch to zoom","archived":false,"fork":false,"pushed_at":"2024-07-14T13:46:46.000Z","size":935,"stargazers_count":82,"open_issues_count":9,"forks_count":9,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-08T11:21:18.832Z","etag":null,"topics":["android","android-library","code","code-editor","codeeditor","editor","edittext","gui","gui-library","hacktoberfest","highlighter","highlighting","kotlin","kotlin-android","kotlin-library","syntax","syntax-highlighting","textview"],"latest_commit_sha":null,"homepage":"","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/markusressel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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":["markusressel"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2018-08-25T18:39:02.000Z","updated_at":"2025-03-03T20:41:53.000Z","dependencies_parsed_at":"2023-12-16T22:38:26.564Z","dependency_job_id":"0b0c8dd9-30ef-4282-b038-615d754159be","html_url":"https://github.com/markusressel/KodeEditor","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/markusressel/KodeEditor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markusressel%2FKodeEditor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markusressel%2FKodeEditor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markusressel%2FKodeEditor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markusressel%2FKodeEditor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markusressel","download_url":"https://codeload.github.com/markusressel/KodeEditor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markusressel%2FKodeEditor/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267814631,"owners_count":24148328,"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-30T02:00:09.044Z","response_time":70,"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":["android","android-library","code","code-editor","codeeditor","editor","edittext","gui","gui-library","hacktoberfest","highlighter","highlighting","kotlin","kotlin-android","kotlin-library","syntax","syntax-highlighting","textview"],"created_at":"2024-10-11T17:26:08.624Z","updated_at":"2025-07-30T05:05:15.983Z","avatar_url":"https://github.com/markusressel.png","language":"Kotlin","readme":"# KodeEditor\nA simple code editor with syntax highlighting and pinch to zoom\n\n![Editing](screenshot/KodeEditor.png)\n\n# Build Status\n\n| Master |\n|--------|\n| [![codebeat badge](https://codebeat.co/badges/f7fa8602-1d15-457e-904d-cb585e984952)](https://codebeat.co/projects/github-com-markusressel-kodeeditor-master) |\n\n# Features\n* [x] Pinch-To-Zoom\n* [x] Line numbers\n* [x] Syntax highlighting\n  * [x] import languages you need\n  * [x] or simply create your own highlighter using **regex** or other techniques\n  * [x] themes\n* [x] \"Minimap\" style document overview\n* [x] Written entirely in Kotlin\n\n# How to use\nHave a look at the demo app (`app`  module) for a complete sample.\n\n## Gradle\nTo use this library just include it in your dependencies using\n\n    repositories {\n        ...\n        maven { url \"https://jitpack.io\" }\n    }\n\nin your project build.gradle file and\n\n```\ndependencies {\n    ...\n\n    def codeEditorVersion = \"v4.0.1\"\n    implementation(\"com.github.markusressel:KodeEditor:${codeEditorVersion}\")\n}\n```\n\nin your desired module ```build.gradle``` file.\n\n## Add to your layout\n\nTo use this editor simply add something similar to this to your desired layout xml file:\n\n```\n\u003cde.markusressel.kodeeditor.library.view.CodeEditorLayout\n        android:id=\"@+id/codeEditorView\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        app:ke_divider_color=\"?android:attr/textColorPrimary\"\n        app:ke_divider_enabled=\"true\"\n        app:ke_editor_backgroundColor=\"?android:attr/windowBackground\"\n        app:ke_editor_maxZoom=\"10.0\"\n        app:ke_lineNumbers_backgroundColor=\"#ccc\"\n        app:ke_lineNumbers_textColor=\"#000\"\n        app:ke_minimap_enabled=\"true\"\n        app:ke_minimap_maxDimension=\"200dp\"\n        app:ke_minimap_borderColor=\"#000\"\n        app:ke_minimap_indicatorColor=\"#f00\"\n        /\u003e\n```\n\n## Syntax highlighting\n\n### Language Autodetection\n\nCurrently there is no auto detection for the language used in a document.\nYou have to manage the syntax highlighter yourself and call the `setSyntaxHighlighter` method when appropriate.\n\n### Integrated syntax highlighters\n\nHave a look at the [KodeHighlighter section about this](https://github.com/markusressel/KodeHighlighter).\n\n### Writing a custom syntax highlighter\n\nHave a look at the [KodeHighlighter section about this](https://github.com/markusressel/KodeHighlighter).\n\n## Styling\n\nKodeEditor can be styled in multiple ways:\n\n1. xml attributes on KodeEditor\n1. theme attributes in your custom theme\n1. methods on the view object itself\n\n### Theme Attributes\n\n| Name                      | Description                              | Type     | Default                                |\n|---------------------------|------------------------------------------|----------|----------------------------------------|\n| ke_lineNumbers_textColor | Specifies the text color of line numbers | Color    | `android.R.attr.textColorPrimary`      |\n| ke_lineNumbers_backgroundColor | Specifies the background color of the line numbers view | Color | `android.R.attr.windowBackground` |\n| ke_divider_enabled | Specifies if a divider should be drawn between line numbers and the actual code editor content | Boolean | `true` |\n| ke_divider_color | Specifies the color of the divider (has no effect if `ke_divider_enabled` is set to `false`) | Color | `android.R.attr.textColorPrimary` |\n| ke_editor_backgroundColor | Specifies the background color of the code editor view | Color | `android.R.attr.windowBackground` |\n| ke_editor_maxZoom | Specifies the maximum zoom level of the editor | Float | `10` |\n| ke_minimap_enabled | Enables the minimap | Boolean | `true` |\n| ke_minimap_maxDimension | Specifies the maximum dimension of the minimap for both axis | Dimension | `150dp` |\n| ke_minimap_borderColor | Specifies the border color of the minimap | Color | `Color.BLACK` |\n| ke_minimap_indicatorColor | Specifies the color of the minimap indicator | Color | `Color.RED` |\n\nYou can either use those attributes directly on the view in your layout like this:\n\n```\n\u003cde.markusressel.kodeeditor.library.view.CodeEditorView\n    android:id=\"@+id/codeEditorView\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    [...]\n    app:ke_divider_color=\"?android:attr/textColorPrimary\"\n    app:ke_divider_enabled=\"true\"\n    app:ke_editor_backgroundColor=\"?android:attr/windowBackground\"\n    app:ke_editor_maxZoom=\"10.0\"\n    app:ke_lineNumbers_backgroundColor=\"#ccc\"\n    app:ke_lineNumbers_textColor=\"#000\"\n    app:ke_minimap_enabled=\"true\"\n    app:ke_minimap_maxDimension=\"200dp\" \n    app:ke_divider=\"true\"\n    [...] /\u003e\n```\n\nor specify them in your application theme (`styles.xml` in dem app) for to apply a style globally:\n\n```\n\u003cresources\u003e\n\n    \u003c!-- Base application theme. --\u003e\n    \u003cstyle name=\"AppTheme\" parent=\"Theme.AppCompat.Light.DarkActionBar\"\u003e\n        \u003c!-- Other theme attributes of your application --\u003e\n        \u003citem name=\"colorPrimary\"\u003e@color/colorPrimary\u003c/item\u003e\n        \u003citem name=\"colorPrimaryDark\"\u003e@color/colorPrimaryDark\u003c/item\u003e\n        \u003citem name=\"colorAccent\"\u003e@color/colorAccent\u003c/item\u003e\n\n        \u003c!-- CodeEditorView --\u003e\n        \u003citem name=\"ke_lineNumbers_backgroundColor\"\u003e#ccc\u003c/item\u003e\n        \u003citem name=\"ke_lineNumbers_textColor\"\u003e#000\u003c/item\u003e\n        \u003citem name=\"ke_divider_enabled\"\u003efalse\u003c/item\u003e\n        \u003citem name=\"ke_divider_color\"\u003e#000\u003c/item\u003e\n        \u003citem name=\"ke_editor_backgroundColor\"\u003e#fff\u003c/item\u003e\n        \u003citem name=\"ke_editor_maxZoom\"\u003e10.0\u003c/item\u003e\n        \u003citem name=\"ke_editor_followCursor\"\u003etrue\u003c/item\u003e\n        \u003citem name=\"ke_minimap_enabled\"\u003etrue\u003c/item\u003e\n        \u003citem name=\"ke_minimap_maxDimension\"\u003e200dp\u003c/item\u003e\n        [...]\n         \n    \u003c/style\u003e\n\n\u003c/resources\u003e\n```\n\n# APIs\n\nAll styling attributes can also be specified using code. Since `KodeEditorLayout`\nis just a wrapper to extend the `CodeEditorView` with line numbers and the minimap to use\nsome of those methods you need to access the matching property of the `KodeEditorLayout` first.\n\n## KodeEditorLayout\n\n| Name | Description | Type |\n|------|-------------|------|\n| text | Sets the given text in the editor. | String |\n| setText(@StringRes) | Sets the given string resource as the text in the editor. | Int |\n| languageRuleBook | Gets/Sets the active language rule book used for highlighting. Use `null` to disable highlighting altogether. | LanguageRuleBook? |\n| editable | Gets/Sets if the editor content is editable. | Boolean |\n\n### Line numbers\n\n| Name | Description | Type |\n|------|-------------|------|\n| showDivider | Gets/Sets if the divider between line numbers and code editor is shown. | Boolean |\n| lineNumberGenerator | Sets text to show for line number based on total number of lines | (Long) -\u003e List\u003cString\u003e |\n\n### Minimap\n\n| Name | Description | Type |\n|------|-------------|------|\n| showMinimap | Gets/Sets if the minimap is shown. | Boolean |\n| minimapMaxDimension | Gets/Sets the maximum dimension of the minimap in pixels. | Float |\n| minimapBorderWidth | Gets/Sets the minimap border size in in pixels. | Number |\n| minimapBorderColor | Gets/Sets the minimap border color. | @ColorInt |\n| minimapIndicatorColor | Gets/Sets the minimap indicator color. | @ColorInt |\n| minimapGravity | Gets/Sets the minimap positioning gravity. | Int |\n\n## CodeEditorView\n\nTo acces these API methods use the `codeEditorLayout.codeEditorView` property.\n\n| Name | Description | Type |\n|------|-------------|------|\n| text | Sets the given text in the editor. | String |\n| setText(@StringRes) | Sets the given string resource as the text in the editor. | Int |\n| getLineCount() | Returns the current line count. | Long |\n| languageRuleBook | Gets/Sets the active language rule book used for highlighting. Use `null` to disable highlighting altogether. | LanguageRuleBook? |\n| editable | Gets/Sets if the editor content is editable. | Boolean |\n| hasSelection | True when a range is selected. | Boolean |\n| selectionStart | The start index of the current selection. | Int |\n| selectionEnd | The end index of the current selection. | Int |\n| selectionChangedListener | Gets/Sets the Listener for selection changes. | SelectionChangedListener? |\n\n\n# Contributing\n\nGitHub is for social coding: if you want to write code, I encourage contributions through pull requests from forks\nof this repository. Create GitHub tickets for bugs and new features and comment on the ones that you are interested in.\n\n# License\n\n```\nMIT License\n\nCopyright (c) 2018 Markus Ressel\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","funding_links":["https://github.com/sponsors/markusressel"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkusressel%2Fkodeeditor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkusressel%2Fkodeeditor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkusressel%2Fkodeeditor/lists"}