{"id":22468107,"url":"https://github.com/patternslib/pat-code-editor","last_synced_at":"2025-03-27T15:43:32.034Z","repository":{"id":37867959,"uuid":"336285289","full_name":"Patternslib/pat-code-editor","owner":"Patternslib","description":"Syntax highlighting and other code editor functionality","archived":false,"fork":false,"pushed_at":"2022-12-12T03:02:21.000Z","size":334,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-04-26T05:21:22.538Z","etag":null,"topics":["hacktoberfest","javascript","patternslib","texteditor","ui-components"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Patternslib.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-05T13:51:42.000Z","updated_at":"2022-10-16T15:28:54.000Z","dependencies_parsed_at":"2023-01-27T12:16:26.918Z","dependency_job_id":null,"html_url":"https://github.com/Patternslib/pat-code-editor","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Patternslib%2Fpat-code-editor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Patternslib%2Fpat-code-editor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Patternslib%2Fpat-code-editor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Patternslib%2Fpat-code-editor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Patternslib","download_url":"https://codeload.github.com/Patternslib/pat-code-editor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245873805,"owners_count":20686654,"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":["hacktoberfest","javascript","patternslib","texteditor","ui-components"],"created_at":"2024-12-06T11:15:10.027Z","updated_at":"2025-03-27T15:43:32.012Z","avatar_url":"https://github.com/Patternslib.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pat-code-editor\n\n## Documentation\n\nThis is code editor pattern based on CodeJar and PrismJS.\n\n\n---\n\n**Note:**\n\nWhen prefilling the textarea, please add HTML escaped content to the template to avoid any XSS security issues or nesting errors with existing HTML.\n\nExample to escape content in Python:\n\n    import html\n    escaped_html = html.escape(unescaped_html)\n\n\nExample to escape content in JavaScript:\n\n    const escaped_html = unescaped_html\n        .replaceAll(\"\u0026amp;\", \"\u0026\")\n        .replaceAll(\"\u0026lt;\", \"\u003c\")\n        .replaceAll(\"\u0026gt;\", \"\u003e\")\n        .replaceAll(\"\u0026quot;\", '\"');\n\n---\n\n### Options reference\n\n| Property       | Default Value | Type              | Description                   |\n| -------------- | ------------- | ----------------- | ----------------------------- |\n| language       | null          | String, null      | Programming language to use.  |\n| linenumbers    | false         | Boolean           | Show line numbers.            |\n| theme          | null          | String            | Name of PrismJS theme.        |\n| tab            | \"'    '\"      | String            | Characters to use as tab. Use \"\\t\" for a tab character, spaces in quotes (e.g. \"'  '\") for spaces |\n| indent-on      | {$            | String            | Regex pattern where the next line is indented. |\n| spellcheck     | false         | Boolean           | Activate spellchecking.       |\n| catch-tab      | true          | Boolean           | Catch a tab keystroke and indent. |\n| preserve-indent | true         | Boolean           | Preserve indentation of original source. |\n| add-closing    | true          | Boolean           | Automatically add closing brackets. |\n| history        | true          | Boolean           | Activate undo history.        |\n\n\n## Examples\n\n### Invocation on a contenteditable div\n\n\u003cdiv class=\"pat-code-editor\" data-pat-code-editor=\"language: javascript\" contenteditable\u003e\nimport Pattern from \"./code-editor\";\nPattern.init(document.querySelector(\".pat-code-editor\"));\n\u003c/div\u003e\n\n```html\n\u003cdiv class=\"pat-code-editor\" data-pat-code-editor=\"language: javascript\" contenteditable\u003e\nimport Pattern from \"./code-editor\";\nPattern.init(document.querySelector(\".pat-code-editor\"));\n\u003c/div\u003e\n```\n\n### Invocation on a textarea\n\nThis will create a div where the code editor is finally initialized and changes are synchronized back to the text editor.\n\n\u003ctextarea class=\"pat-code-editor\" data-pat-code-editor=\"language: css\"\u003e\nbody {\n  background-color: black;\n  color: blue;\n}\n\u003c/textarea\u003e\n\n```html\n\u003ctextarea class=\"pat-code-editor\" data-pat-code-editor=\"language: css\"\u003e\nbody {\n  background-color: black;\n  color: blue;\n}\n\u003c/textarea\u003e\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatternslib%2Fpat-code-editor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatternslib%2Fpat-code-editor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatternslib%2Fpat-code-editor/lists"}