{"id":31970626,"url":"https://github.com/hubspot/executr","last_synced_at":"2025-10-14T19:17:09.351Z","repository":{"id":6526516,"uuid":"7767547","full_name":"HubSpot/executr","owner":"HubSpot","description":"Let your users execute the CoffeeScript in your documentation","archived":false,"fork":false,"pushed_at":"2013-10-29T19:16:53.000Z","size":651,"stargazers_count":35,"open_issues_count":3,"forks_count":9,"subscribers_count":173,"default_branch":"master","last_synced_at":"2024-04-14T05:24:44.777Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/HubSpot.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}},"created_at":"2013-01-23T04:13:58.000Z","updated_at":"2021-06-14T02:37:57.000Z","dependencies_parsed_at":"2022-09-08T03:00:59.971Z","dependency_job_id":null,"html_url":"https://github.com/HubSpot/executr","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/HubSpot/executr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HubSpot%2Fexecutr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HubSpot%2Fexecutr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HubSpot%2Fexecutr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HubSpot%2Fexecutr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HubSpot","download_url":"https://codeload.github.com/HubSpot/executr/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HubSpot%2Fexecutr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279020651,"owners_count":26086895,"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-10-14T02:00:06.444Z","response_time":60,"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":[],"created_at":"2025-10-14T19:17:05.986Z","updated_at":"2025-10-14T19:17:09.343Z","avatar_url":"https://github.com/HubSpot.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## executr\n\nLet your users execute and play with the CoffeeScript and JavaScript in your documentation\n\n### Example\n\nSee our messenger documentation for an example: http://hubspot.github.com/messenger/\n\n### Including\n\n````html\n\u003c!-- You should already have jQuery included --\u003e\n\n\u003c!-- Code Mirror is used to make the code blocks editable --\u003e\n\u003cscript type=\"text/javascript\" src=\"lib/CodeMirror/codemirror.js\"\u003e\u003c/script\u003e\n\n\u003c!-- Include the CodeMirror languages you're going to use --\u003e\n\u003cscript type=\"text/javascript\" src=\"lib/CodeMirror/mode/coffeescript/coffeescript.js\"\u003e\u003c/script\u003e\n\u003cscript type=\"text/javascript\" src=\"lib/coffee-script.js\"\u003e\u003c/script\u003e\n\n\u003cscript type=\"text/javascript\" src=\"build/js/executr.js\"\u003e\u003c/script\u003e\n\n\u003clink rel=\"stylesheet\" type=\"text/css\" media=\"screen\" href=\"lib/CodeMirror/codemirror.css\"\u003e\n\u003clink rel=\"stylesheet\" type=\"text/css\" media=\"screen\" href=\"build/css/executr.css\"\u003e\n````\n\n### Usage\n\nThe code blocks you wish to be executable should be wrapped in `\u003ccode executable\u003e\u003c/code\u003e`.\n\nRun `$.executr` on the container of multiple code elements, the body, or a single code block.\n\nThe blocks will be converted into CodeMirror Editors, and a run button will be added.  If you're not interested\nin the code being editable, take a look at the v1.1 tag.\n\nOnly the text (not tags) in the block will be executed, feel free to wrap your already-syntax-highlighted code.\n\nThe code editor will assume the height + 10px and width of the code element.\n\n````html\n\u003cpre\u003e\u003ccode executable\u003e\n$ -\u003e\n  alert \"Testing!\"\n\u003c/code\u003e\u003c/pre\u003e\n````\n\n````javascript\n$(function(){\n  $('body').executr();\n});\n````\n\nYou can also make javascript executable, by either adding a `data-type=\"javascript\"` attribute to the code\nblock, or by adding `defaultType: 'javascript'` to the executr call.\n\n````html\n\u003ccode data-type=\"javascript\" executable\u003e\nalert(\"Testing!\");\n\u003c/code\u003e\n````\n\n### Other Options\n\n$.executr can be passed the following options\n\n````coffeescript\n{\n    codeSelector: 'code[executable]' # The jQuery selector items to be bound must match\n\n    outputTo: 'div.output' # An element which should receive the output.\n    appendOutput: true # Whether output should replace the contents of outputTo, or append to it\n\n    defaultType: 'coffeescript' # The default source languange, if not supplied as a data-type attribute\n    type: 'coffeescript' # The type to force on all code blocks, even if otherwise specified.  Can also be a function.\n    coffeeOptions: {} # Extra options for the CoffeeScript compiler\n\n    codeMirrorOptions: {} # Extra options for CodeMirror\n\n    setUp: -\u003e # Code to run before each code block\n    tearDown: -\u003e # Code to run after each code block\n}\n````\n\n#### Events\n\nExecutr will fire two events on the element it is bound to:\n\n- `executrBeforeExecute(code string, normalized code language, executr options)`\n- `executrAfterExecute(code output, code string, normalized code language, executr options)`\n\n#### Contributing\n\nYou can build the project by running `./build.sh`.  It requires the CoffeeScript compiler.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhubspot%2Fexecutr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhubspot%2Fexecutr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhubspot%2Fexecutr/lists"}