{"id":15048995,"url":"https://github.com/codeabinash/aurora","last_synced_at":"2025-04-10T01:40:40.871Z","repository":{"id":204108248,"uuid":"710930922","full_name":"codeAbinash/aurora","owner":"codeAbinash","description":"The C code highlighting engine for the web.","archived":false,"fork":false,"pushed_at":"2024-07-18T18:25:08.000Z","size":935,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-08T00:03:08.407Z","etag":null,"topics":["c","c-code-highlight","c-lang","c-language","code-highlight","code-highlighter","highlight"],"latest_commit_sha":null,"homepage":"https://try-aurora.vercel.app/","language":"C","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/codeAbinash.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}},"created_at":"2023-10-27T18:50:57.000Z","updated_at":"2025-01-01T08:26:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"61b1abc3-f735-40f8-9cff-656efeffe901","html_url":"https://github.com/codeAbinash/aurora","commit_stats":null,"previous_names":["codeabinash/aurora"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeAbinash%2Faurora","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeAbinash%2Faurora/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeAbinash%2Faurora/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeAbinash%2Faurora/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codeAbinash","download_url":"https://codeload.github.com/codeAbinash/aurora/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248142004,"owners_count":21054574,"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":["c","c-code-highlight","c-lang","c-language","code-highlight","code-highlighter","highlight"],"created_at":"2024-09-24T21:17:30.193Z","updated_at":"2025-04-10T01:40:40.843Z","avatar_url":"https://github.com/codeAbinash.png","language":"C","readme":"# Aurora 🎨 / Core\n\n![GitHub release (with filter)](https://img.shields.io/github/v/release/codeAbinash/aurora?color=limegreen)\n![npm bundle size](https://img.shields.io/bundlephobia/minzip/aurora-code?color=aa3aec)\n![License](https://img.shields.io/github/license/codeAbinash/aurora?color=orangered)\n\n![Aurora](https://try-aurora.vercel.app/aurora.png)\n\nThe C code highlighting engine for the web.\n\n\u003e If you are using React, use [aurora-react](https://github.com/codeAbinash/aurora-react) 🚀.\n\n## Installation\n\n### Using npm\n\n```bash\nnpm install aurora-code\n```\n\n### Es module\n\n```js\nimport aurora from 'aurora-code';\n```\n\n### CommonJS\n\n```js\nconst aurora = require('aurora-code');\n```\n\n### Directly import Es module from CDN\n\n```js\nimport aurora from 'https://cdn.jsdelivr.net/npm/aurora-code@latest/dist/index.js';\n```\n\n### Directly include Script tag from CDN\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/aurora-code@latest/dist/index.umd.cjs\" type=\"application/json\"\u003e\u003c/script\u003e\n```\n\n## Concept\n\nThe aurora function takes two arguments, the first one is the code to be highlighted and the second one is the options object.\n\n```ts\naurora(code);\naurora(code, config);\n```\n\n\u003e ### `aurora(code)` returns a string which is the highlighted code.\n\n\u003e Code is a string which is C code to be highlighted.\n\u003e Options is an object which is optional.\n\n### Options\n\n```ts\naurora(code, {\n  mode: 'class'; // It uses classnames to highlight the code\n}) // It is the default (Recommended)\n```\n\n```ts\naurora(code, {\n  mode: 'inline'; // It uses inline styles to highlight the code\n}) // It uses one dark pro theme if no styles are provided\n```\n\n```ts\naurora(code, {\n  mode: 'inline', // It uses inline styles to highlight the code\n  styles: {\n    comment: '#808080',\n    keyword: '#00FF00',\n    name: '#0000FF',\n    function: '#32CD32',\n    string: '#FFC0CB',\n  },\n}); // Not recommended\n```\n\n```css\n/* Custom theme */\n.aurora-string {\n  color: pink;\n}\n.aurora-keyword {\n  color: lime;\n}\n```\n\n\u003e You can define your own styles for each token type. See the detailed [Configuration](#detailed-configuration).\n\n## Usage\n\n### Using React\n\nIf you are using React you can use\n\n```tsx\nimport aurora from 'aurora-code';\nimport 'aurora-code/themes/oneDarkPro.css'; // (css file)\n// or you may use your own css\n...\n...\n  \u003cpre\u003e\n    \u003ccode dangerouslySetInnerHTML={{ __html: aurora(h) }}\u003e\u003c/code\u003e\n  \u003c/pre\u003e\n...\n...\n```\n\n\u003e Use state variables and useEffect to update the code and prevent rerendering. Or you can use [aurora-react](https://github.com/codeAbinash/aurora-react) 🚀. It takes care of all these things.\n\n### Using HTML and CSS\n\n```html\n\u003cscript type=\"module\" src=\"index.js\"\u003e\u003c/script\u003e\n\u003ccode id=\"code-block\"\u003e\u003c/div\u003e\n```\n\n```js\nimport aurora from 'https://cdn.jsdelivr.net/npm/aurora-code@latest/dist/index.js';\nconst codeBlock = document.getElementById('code-block');\nconst code = `\nint main() {\n   printf(\"Hello, World!\");\n   return 0;\n}`;\ncodeBlock.innerHTML = aurora(code);\n```\n\n## Using Local Files\n\nDownload the https://cdn.jsdelivr.net/npm/aurora-code@latest/dist/index.umd.cjs and https://cdn.jsdelivr.net/npm/aurora-code@latest/dist/themes/oneDarkPro.css files and use them locally.\n\n```html\n\u003cscript src=\"../../dist/index.umd.cjs\" defer\u003e\u003c/script\u003e\n\n\u003clink rel=\"stylesheet\" href=\"../../dist/themes/oneDarkPro.css\" /\u003e\n\n\u003cbody style=\"background-color: #070e22\"\u003e\n  \u003cpre\u003e\u003ccode id=\"code-block\"\u003e\u003c/code\u003e\u003c/pre\u003e\n  \u003cscript\u003e\n    document.body.onload = () =\u003e {\n      const codeBlock = document.getElementById('code-block');\n      const code = 'int main() {\\n  printf(\"Hello World!\");\\n  return 0;\\n}';\n      codeBlock.innerHTML = aurora.default(code);\n    };\n  \u003c/script\u003e\n\u003c/body\u003e\n```\n\n## Detailed Configuration\n\nHere is an example of theme object for configuring the theme.\n\n```ts\n// One Dark Pro Theme\none_dark_pro = {\n  comment: '#5c6370',\n  comment_start: '#5c6370',\n  comment_end: '#5c6370',\n  preprocessor: '#c678dd',\n  defined: '#d19a66',\n  header_file: '#98c379',\n  keyword: '#c678dd',\n  name: '#ef596f',\n  string: '#98c379',\n  'quote single': '#98c379',\n  'quote double': '#98c379',\n  'quote angle': '#98c379',\n  format_specifier: '#d19a66',\n  number: '#d19a66',\n  bin_prefix: '#ef596f',\n  hex_prefix: '#ef596f',\n  oct_prefix: '#ef596f',\n  function: '#61afef',\n  operator: '#c678dd',\n  escape: '#56b6c2',\n  'open_paren bracket0': '#d19a66',\n  'open_curly bracket0': '#d19a66',\n  'close_paren bracket0': '#d19a66',\n  'close_curly bracket0': '#d19a66',\n  'open_paren bracket1': '#c678dd',\n  'open_curly bracket1': '#c678dd',\n  'close_paren bracket1': '#c678dd',\n  'close_curly bracket1': '#c678dd',\n  'open_paren bracket2': '#56b6c2',\n  'close_curly bracket2': '#56b6c2',\n  'close_paren bracket2': '#56b6c2',\n  'open_curly bracket2': '#56b6c2',\n  'open_square bracket0': '#c678dd',\n  'close_square bracket0': '#c678dd',\n  'open_square bracket1': '#d19a66',\n  'close_square bracket1': '#d19a66',\n  'open_square bracket2': '#56b6c2',\n  'close_square bracket2': '#56b6c2',\n};\n```\n\nHere is an example of theme [css](https://github.com/codeAbinash/aurora/blob/main/public/themes/oneDarkPro.css).\n\n## Contributing\n\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeabinash%2Faurora","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodeabinash%2Faurora","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeabinash%2Faurora/lists"}