{"id":27075168,"url":"https://github.com/BomdiZane/codebox","last_synced_at":"2025-04-06T00:02:47.605Z","repository":{"id":39792341,"uuid":"239874080","full_name":"dev-juju/codebox","owner":"dev-juju","description":"Code highlighting tool for Editor.js","archived":false,"fork":false,"pushed_at":"2023-03-15T05:18:58.000Z","size":487,"stargazers_count":32,"open_issues_count":11,"forks_count":19,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-01T19:04:17.333Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dev-juju.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":"dev-juju","patreon":"bomdisoft"}},"created_at":"2020-02-11T22:04:14.000Z","updated_at":"2024-03-09T16:02:03.000Z","dependencies_parsed_at":"2023-07-17T12:38:24.124Z","dependency_job_id":null,"html_url":"https://github.com/dev-juju/codebox","commit_stats":{"total_commits":31,"total_committers":2,"mean_commits":15.5,"dds":0.09677419354838712,"last_synced_commit":"46b0d4e6bf98b1c44a74f1b76b4c7e344dae3093"},"previous_names":["bomdizane/codebox"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev-juju%2Fcodebox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev-juju%2Fcodebox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev-juju%2Fcodebox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev-juju%2Fcodebox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dev-juju","download_url":"https://codeload.github.com/dev-juju/codebox/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247415958,"owners_count":20935388,"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":[],"created_at":"2025-04-06T00:01:42.227Z","updated_at":"2025-04-06T00:02:47.599Z","avatar_url":"https://github.com/dev-juju.png","language":"TypeScript","funding_links":["https://github.com/sponsors/dev-juju","https://patreon.com/bomdisoft"],"categories":["Tools"],"sub_categories":["Block Tools"],"readme":"# CodeBox\n\n[![](https://img.shields.io/npm/v/@bomdi/codebox)](https://www.npmjs.com/package/@bomdi/codebox)\n[![](https://img.shields.io/npm/dw/@bomdi/codebox)](https://www.npmjs.com/package/@bomdi/codebox)\n[![](https://flat.badgen.net/npm/license/@bomdi/codebox)](https://www.npmjs.com/package/@bomdi/codebox)\n[![](https://flat.badgen.net/badge/icon/typescript?icon=typescript\u0026label)](https://www.npmjs.com/package/@bomdi/codebox)\n\nCode syntax highlighting tool for [Editor.js](https://editorjs.io/)\n\n## Setup\n\nInstall the package via NPM\n\n```shell\nnpm i @bomdi/codebox\n```\n\nAdd to your module/application\n\n```javascript\nimport CodeBox from '@bomdi/codebox';\nOR\nconst CodeBox = require('@bomdi/codebox');\n```\n\n\n## Usage\n\nAdd CodeBox `tools` property of the CodeX Editor initial config.\n\n```javascript\nconst CodexEditor = require('@editorjs/editorjs');\n\nlet editor = new CodexEditor({\n  ...\n\n  tools: {\n    ...\n    codeBox: {\n      class: CodeBox,\n      config: {\n        themeURL: 'https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.18.1/build/styles/dracula.min.css', // Optional\n        themeName: 'atom-one-dark', // Optional\n        useDefaultTheme: 'light' // Optional. This also determines the background color of the language select drop-down\n      }\n    },\n  }\n\n  ...\n});\n```\n\n## Config Params\n\n**All parameters are optional**\n\n| Field              | Type     | Description                   |\n| ------------------ | -------- | ------------------------------|\n| themeURL           | `string` | URL pointing to CSS file that can be used by [highlight.js](https://highlightjs.org/). This could also point o your own custom CSS syntax file. If **themeURL** is provided, **themeName** and **useDefaultTheme** will be ignored |\n| themeName          | `string` | Any one of the [accepted theme names](https://github.com/highlightjs/highlight.js/tree/master/src/styles) used by **highlight.js**. Only the name is required, not the full URL (example \"a11y-dark\"). If **themeName** is provided, **useDefaultTheme** will be ignored |\n| useDefaultTheme    | `string` | **CodeBox** has 2 default themes - 1 light and 1 dark. You can specify what default should be applied by passing the string **'light'** or **'dark'** to this parameter. Note that setting **themeURL** or **themeName** overrides this setting for the main code block, however, the background of the language select element/dropdown menu is set by this value |\n\nIf no parameters are specified, CodeBox defaults to a dark theme.\n\n## Output data\n\nCodeBox returns the following data\n\n```json\n{\n  \"type\": \"codeBox\",\n  \"data\": {\n    \"code\": \"consttest = newTest();.codeBoxTextArea{\\n  width: 100%;\\n  min-height: 30px;\\n  padding: 10px;\\n  border-radius: 2px 2px 2px 0;\\n  border: none !important;\\n  outline: none !important;\\n  font: 14px monospace;\\n}\\n\\n.codeBoxSelectDiv{\\n  display: flex;\\n  flex-direction: column;\\n  justify-content: flex-start;\\n  align-items: flex-start;\\n  position: relative;\\n}\",\n    \"language\": \"css\",\n    \"theme\": \"https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.18.1/build/styles/atom-one-dark.min.css\"\n  }\n}\n```\n\n## Render saved data as component\n\nIf you use react, you can pass your saved data to the library [editorjs-react-renderer](https://www.npmjs.com/package/editorjs-react-renderer) to render a code block component\n\n```javascript\nimport { CodeBoxOutput } from 'editorjs-react-renderer';\n\nconst data = {\n  \"type\": \"codeBox\",\n  \"data\": {\n    \"code\": \".codeBoxTextArea{\\n  width: 100%;\\n  min-height: 30px;\\n  padding: 10px;\\n  border-radius: 2px 2px 2px 0;\\n  border: none !important;\\n  outline: none !important;\\n  font: 14px monospace;\\n}\\n\\n.codeBoxSelectDiv{\\n  display: flex;\\n  flex-direction: column;\\n  justify-content: flex-start;\\n  align-items: flex-start;\\n  position: relative;\\n}\",\n    \"language\": \"css\",\n    \"theme\": \"https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.18.1/build/styles/atom-one-dark.min.css\"\n  }\n};\n\nconst CodeBlock = () =\u003e CodeBoxOutput(data);\n\nexport default CodeBlock;\n```\n\n\n## Author\n\nDev Juju\n\n[Contact Us](https://bomdisoft.com)\n\n[Learn](https://devjuju.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBomdiZane%2Fcodebox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBomdiZane%2Fcodebox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBomdiZane%2Fcodebox/lists"}