{"id":13474061,"url":"https://github.com/alexwforsythe/code-blocks","last_synced_at":"2025-03-26T20:31:48.151Z","repository":{"id":37458129,"uuid":"68638466","full_name":"alexwforsythe/code-blocks","owner":"alexwforsythe","description":"Syntax highlighting for Google Docs","archived":false,"fork":false,"pushed_at":"2023-09-14T19:05:06.000Z","size":744,"stargazers_count":706,"open_issues_count":134,"forks_count":90,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-10-30T07:45:28.564Z","etag":null,"topics":["google-apps-script","google-docs-addon","syntax-highlighting"],"latest_commit_sha":null,"homepage":"https://www.alexwforsythe.com/code-blocks/","language":"JavaScript","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/alexwforsythe.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},"funding":{"custom":"https://www.paypal.com/paypalme/alexwforsythe"}},"created_at":"2016-09-19T19:22:28.000Z","updated_at":"2024-10-25T11:27:11.000Z","dependencies_parsed_at":"2023-10-20T16:36:18.637Z","dependency_job_id":null,"html_url":"https://github.com/alexwforsythe/code-blocks","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexwforsythe%2Fcode-blocks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexwforsythe%2Fcode-blocks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexwforsythe%2Fcode-blocks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexwforsythe%2Fcode-blocks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexwforsythe","download_url":"https://codeload.github.com/alexwforsythe/code-blocks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245731588,"owners_count":20663212,"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":["google-apps-script","google-docs-addon","syntax-highlighting"],"created_at":"2024-07-31T16:01:09.236Z","updated_at":"2025-03-26T20:31:46.479Z","avatar_url":"https://github.com/alexwforsythe.png","language":"JavaScript","readme":"![img](https://repository-images.githubusercontent.com/68638466/d3069380-02d3-11ea-8d09-bb881c87c125)\n\n[![clasp](https://img.shields.io/badge/built%20with-clasp-4285f4.svg)](https://github.com/google/clasp) [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/alexwforsythe)\n\n\u003ca href=\"https://workspace.google.com/marketplace/app/code_blocks/100740430168?pann=b\" target=\"_blank\" aria-label=\"Get it from the Google Workspace Marketplace\"\u003e\n  \u003cimg alt=\"Google Workspace Marketplace badge\" alt-text=\"Get it from the Google Workspace Marketplace\" src=\"https://workspace.google.com/static/img/marketplace/en/gwmBadge.svg?\" style=\"height: 68px\"\u003e\n\u003c/a\u003e\n\n# Usage\n\n## Starting the add-on\n\n![starting](https://user-images.githubusercontent.com/1639061/68648430-3b709300-04d5-11ea-912f-2e767f37db56.gif)\n\n## Formatting inline code\n\n![inline-formatting](https://user-images.githubusercontent.com/1639061/68643446-48d25100-04c6-11ea-96e8-090333e95559.gif)\n\n## Formatting code blocks\n\n![blocks-formatting](https://user-images.githubusercontent.com/1639061/68649759-51338780-04d8-11ea-9e39-5793dec16a4e.gif)\n\n## Reformatting code blocks\n\n![reformatting-blocks](https://user-images.githubusercontent.com/1639061/68648457-4297a100-04d5-11ea-9787-6e9ecbedfdc1.gif)\n\n## Previewing themes\n\nExamples of the different color themes applied to various languages can be\nfound on the [highlight.js demo page](https://highlightjs.org/static/demo/).\n\n## Unformatting code\n\nTo clear formatting in Docs, highlight the text and select\n`Format \u003e Clear Formatting` from the toolbar. The keyboard shortcut is\n\u003ckbd\u003eCmd\u003c/kbd\u003e+\u003ckbd\u003e/\u003c/kbd\u003e on OS X and \u003ckbd\u003eCtrl\u003c/kbd\u003e+\u003ckbd\u003e/\u003c/kbd\u003e on\nWindows:\nhttps://support.google.com/docs/answer/179738\n\nThis will not remove the table that the text lives in if it's a \"code block\".\nTo do that, you'll have to copy the text and paste it outside the table, then\nright-click the table and select **Delete table**.\n\n# Limitations\n\n## Updates to syntax highlighting\n\nCode Blocks is built with [highlight.js](https://highlightjs.org/) and can only\nprovide syntax highlighting for languages that are supported by that library.\n\nIf you'd like to see Code Blocks support a language that is not yet implemented\nby highlight.js, please refer to [their page on requesting new languages](http://highlightjs.readthedocs.io/en/latest/language-requests.html).\n\nIf you'd like to see Code Blocks update or fix support for an existing language:\n1. Check if the [latest version of highlight.js](https://github.com/highlightjs/highlight.js/releases)\nalready includes the update. If it does, submit a PR to this repository that\nbumps the highlight.js version in [`package.json`](https://github.com/alexwforsythe/code-blocks/blob/master/package.json).\n2. If highlight.js does not yet include the update, please submit an issue on\n[their issue tracker](https://github.com/highlightjs/highlight.js/issues).\n\n## Real-time syntax highlighting\n\nCodes Blocks uses Google's\n[Apps Script](https://developers.google.com/apps-script/), a server-side\nJavaScript platform, to interact with Docs and format code. Each time the add-on\nformats a snippet of code, a request is made to the Apps Script backend to\nmodify the current Doc. There are a few limitations of this platform that\nprevent Code Blocks from formatting code as you type:\n* The [`onEdit`](https://developers.google.com/apps-script/guides/triggers#onedite)\nevent that fires when a user modifies content is only available in Sheets\n* [Time-driven triggers](https://developers.google.com/apps-script/guides/triggers/installable#time-driven_triggers)\ncan only be used once per hour at most\n* Each request to modify the current Doc can take multiple seconds, so code\nformatting cannot be performed in real-time\n* The number of requests needed to update a Doc in near real-time may exceed\nthe service API quotas\n\n## Keyboard Shortcuts\n\nKeyboard shortcuts can only be handled by Code Blocks if the add-on sidebar is\nfocused, which would require users to click the sidebar anyway.\n\nKeyboard events in the active document cannot currently be handled by Docs\nadd-ons:\nhttps://issuetracker.google.com/issues/79461369\n\n# Contributing\n\n## Setup\n\n```\n$ npm install\n```\n\n## Building\n\n```\n$ npm run build\n```\n\n## Pushing Changes\n\nℹ️ The following commands only work for the project maintainer\nbecause they require Google Drive authorization.\n\n| Command | Description |\n| --- | --- |\n| `npm run push:gas` | just GAS files |\n| `npm run push:js` | just `sidebar.js` |\n| `npm run push:static` | just HTML \u0026 CSS |\n| `npm run push` | everything |\n\n# Google Apps Script Resources\n\n* https://developers.google.com/apps-script/guides/clasp\n* https://github.com/google/clasp/blob/master/docs/typescript.md\n* https://developers.google.com/apps-script/guides/support/best-practices\n* https://gsuite-developers.googleblog.com/2015/12/advanced-development-process-with-apps.html\n* http://googleappsscript.blogspot.com/2010/06/optimizing-spreadsheet-operations.html\n\n---\n\n[Homepage](https://www.alexwforsythe.com/code-blocks/) | [Google Workspace Marketplace](https://workspace.google.com/marketplace/app/code_blocks/100740430168) | [Privacy Policy](https://www.alexwforsythe.com/code-blocks/privacy-policy) | [Terms of Service](https://www.alexwforsythe.com/code-blocks/terms-of-service)\n","funding_links":["https://www.paypal.com/paypalme/alexwforsythe","https://paypal.me/alexwforsythe"],"categories":["JavaScript","Open Source Apps \u0026 Add-ons"],"sub_categories":["Services"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexwforsythe%2Fcode-blocks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexwforsythe%2Fcode-blocks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexwforsythe%2Fcode-blocks/lists"}