{"id":14070257,"url":"https://github.com/mokeyish/obsidian-code-emitter","last_synced_at":"2025-05-16T10:07:16.206Z","repository":{"id":50565708,"uuid":"519450328","full_name":"mokeyish/obsidian-code-emitter","owner":"mokeyish","description":"An obsidian plugin that allows  code blocks executed interactively in sandbox like jupyter notebooks. Supported language rust、kotlin、python、Javascript、TypeScript etc.","archived":false,"fork":false,"pushed_at":"2024-12-12T00:16:39.000Z","size":1052,"stargazers_count":321,"open_issues_count":37,"forks_count":15,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-09T07:01:32.526Z","etag":null,"topics":["code-runner","jupyter","markdown","obsidan"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mokeyish.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":"2022-07-30T07:32:13.000Z","updated_at":"2025-04-05T19:45:45.000Z","dependencies_parsed_at":"2023-01-22T20:15:16.021Z","dependency_job_id":"d871dfb2-13eb-4a94-80d7-a14e5e4b2efe","html_url":"https://github.com/mokeyish/obsidian-code-emitter","commit_stats":{"total_commits":45,"total_committers":7,"mean_commits":6.428571428571429,"dds":"0.28888888888888886","last_synced_commit":"b0e88851f016987c8529e6f6f035809eddb6d253"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mokeyish%2Fobsidian-code-emitter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mokeyish%2Fobsidian-code-emitter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mokeyish%2Fobsidian-code-emitter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mokeyish%2Fobsidian-code-emitter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mokeyish","download_url":"https://codeload.github.com/mokeyish/obsidian-code-emitter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254509476,"owners_count":22082891,"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":["code-runner","jupyter","markdown","obsidan"],"created_at":"2024-08-13T07:07:36.523Z","updated_at":"2025-05-16T10:07:11.197Z","avatar_url":"https://github.com/mokeyish.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# Obsidian Code Emitter\n\n![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/mokeyish/obsidian-code-emitter?display_name=tag\u0026include_prereleases)\n![GitHub all releases](https://img.shields.io/github/downloads/mokeyish/obsidian-code-emitter/total?style=flat-square)\n\nThis plugin allows code blocks to be executed interactively like in Jupyter Notebooks.\nIt has no external environment requirements (such as system installations of compilers), because code execution works via local sandboxes using JavaScript or WebAssembly technology, or network requests to online Playgrounds.\nThis means it can support all platforms supported by Obsidian.\n\nSupports all Obsidian supported platforms, including:\n\n- Windows\n- macOS\n- Linux\n- Android\n- iOS\n\nSupported languages:\n\n| Language           | Provider                                                                                        |\n| ------------------ | ----------------------------------------------------------------------------------------------- |\n| C/C++              | [Sololearn](https://www.sololearn.com)                                                          |\n| C#                 | [Sololearn](https://www.sololearn.com)                                                          |\n| Go                 | [Sololearn](https://www.sololearn.com)                                                          |\n| Haskell            | https://play.haskell.org                                                                        |\n| HTML \u0026 CSS         | [Shadow DOM](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_shadow_DOM)  |\n| Java               | [Sololearn](https://www.sololearn.com)                                                          |\n| JavaScript         | JS Sandbox ([qiankun](https://github.com/umijs/qiankun/blob/master/src/sandbox/index.ts))       |\n| Kotlin             | https://play.kotlinlang.org                                                                     |\n| Python             | WebAssembly ([Pyodide](https://github.com/pyodide/pyodide))                                     |\n| R                  | [Sololearn](https://www.sololearn.com)                                                          |\n| Rust               | https://play.rust-lang.org                                                                      |\n| Swift              | [Sololearn](https://www.sololearn.com)                                                          |\n| TypeScript         | [TypeScript](https://www.typescriptlang.org/) Compiler + JS Sandbox                             |\n| V                  | https://play.vosca.dev/                                                                         |\n| Wenyan             | [Wenyan](https://github.com/wenyan-lang/wenyan)  Compiler + JS Sandbox                          |\n\n\u003e [!NOTE]  \n\u003e Only `Python`, `TypeScript`, and `JavaScript` are run in a local sandbox (JS/WebAssembly).\n\u003e Others will send code to third-party website to evaluate the results (e.g.: https://play.kotlinlang.org, https://play.rust-lang.org).\n\u003e Please take care to avoid sending your potentially-sensitive source code.\n\n**Ads**: You might like my other plugins 🤪\n\n- [Obsidian Enhancing Export](https://github.com/mokeyish/obsidian-enhancing-export)\n\n---\n\n![.](./screenshots/code-emitter.gif)\n\n## Installation\n\n1. Search `Code Emitter` in the **Community plugins** section of [Obsidian](https://obsidian.md/), and install it.\n\n## Examples\n\n### Python\n\nInstall `numpy` through `micropip`. All available packages are listed [here](https://github.com/mokeyish/pyodide-dist/find/master) (search for `whl`).\n\n#### Using `numpy`\n\n```python\nimport micropip\nawait micropip.install('numpy')  \nimport numpy as np\na = np.random.rand(3,2)\nb = np.random.rand(2,5)\n\nprint(a@b)\n```\n\n#### Using `matplotlib`\n\n```python\nimport micropip\nawait micropip.install('matplotlib')\n\nimport matplotlib.pyplot as plt\n\nfig, ax = plt.subplots()             # Create a figure containing a single Axes.\nax.plot([1, 2, 3, 4], [1, 4, 2, 3])  # Plot some data on the Axes.\nplt.show()                           # Show the figure.\n```\n\n### HTML \u0026 CSS\n\n```html\n\u003cdiv\u003e\u003cspan class=\"h\"\u003eHello\u003c/span\u003e\u003cspan class=\"w\"\u003eworld\u003c/span\u003e\u003c/div\u003e\n\n\u003cstyle\u003e\n.h {\n  color: red;\n}\n.w {\n  color: green;\n}\n\u003c/style\u003e\n```\n\n### Any languages that support CORS\n\nHere is the example to support Ruby.\n\n```typescript\nconst url = 'https://api2.sololearn.com/v2/codeplayground/v2/compile';\n\nconst runCode = async (code: string, lang: 'cpp' | 'go' | 'c' | 'java' | 'cs' | 'swift' | 'rb') =\u003e {\n  const header = {\n    'User-Agent': 'Obsidian Code Emitter/0.1.0 (If this is not allowed, please let me know)',\n    'Accept': 'application/json, text/plain, */*',\n    'Accept-Language': 'en-US',\n    'Content-Type': 'application/json',\n  };\n\n  const res = await fetch(url, {\n    'headers': header,\n    'body': JSON.stringify({\n      'code': code,\n      'codeId': null,\n      'input': '',\n      'language': lang\n    }),\n    'method': 'POST',\n  });\n  return (await res.json()) as {\n    success: boolean,\n    errors: string[],\n    data: {\n      sourceCode: number,\n      status: number,\n      errorCode: number,\n      output: string,\n      date: string,\n      language: string,\n      input: string,\n    }\n  };\n};\n\nconst ruby_code = `\nputs \"Hello World12\"\n`;\n\n\nconsole.log((await runCode(ruby_code, 'rb')).data.output);\n```\n\n\n\n## License\n\nThis plugin sandbox contains codes from [https://github.com/umijs/qiankun](https://github.com/umijs/qiankun/blob/master/src/sandbox/index.ts), which is licensed under\n\n- MIT license (LICENSE-MIT or [http://opensource.org/licenses/MIT](http://opensource.org/licenses/MIT))\n\nAnd other codes is licensed under\n\n- GPL-3.0 license (LICENSE-GPL-3.0 or [https://opensource.org/licenses/GPL-3.0](https://opensource.org/licenses/GPL-3.0))\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmokeyish%2Fobsidian-code-emitter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmokeyish%2Fobsidian-code-emitter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmokeyish%2Fobsidian-code-emitter/lists"}