• Stars
    star
    243
  • Rank 166,489 (Top 4 %)
  • Language
    TypeScript
  • License
    GNU General Publi...
  • Created over 2 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An obsidian plugin that allows code blocks executed interactively in sandbox like jupyter notebooks. Supported language rust、kotlin、python、Javascript、TypeScript etc.

Obsidian Code Emitter

GitHub release (latest by date including pre-releases) GitHub all releases

This plugin allows code blocks executed interactively like jupyter notebooks. It is based on HTTP REST APIs and JS sandbox and Webassembly technology, and has no local environment requirements, so it supports all platforms supported by Obsidian.

Supports all Obsidian supported platforms, includes:

  • Windows
  • MacOS
  • Linux
  • Android
  • IOS

Currently, support languages:

Supported language Way
Rust https://play.rust-lang.org
Kotlin https://play.kotlinlang.org
V https://play.vosca.dev/
JavaScript JS Sandbox (qiankun)
TypeScript[] TypeScript Compiler + JS Sandbox
Wenyan Wenyan Compiler + JS Sandbox
Python WebAssembly (Pyodide)
Java Sololearn
Go Sololearn
c/c++ Sololearn
CSharp Sololearn
Swift Sololearn
R Sololearn

Note: Only PythonTypeScriptJavaScript are run locally in sandbox(js / webassembly). Other's will send code to third-party website to eval the results (eg: https://play.kotlinlang.org, https://play.rust-lang.org). Please take care to avoid sending your potentially-sensitive source code.

Ads: You might like my other plugins 🤪


.

Installation

  1. Search Code Emitter in the community plugins of obsidian, and install it.

Examples

Python

Install numpy through micropip. All available packages are list in here (search whl).

import micropip
await micropip.install('numpy')  
import numpy as np
a = np.random.rand(3,2)
b = np.random.rand(2,5)

print(a@b)

Any languages that support CORS

Here is the example to support Ruby.

const url = 'https://api2.sololearn.com/v2/codeplayground/v2/compile';

const runCode = async (code: string, lang: 'cpp' | 'go' | 'c' | 'java' | 'cs' | 'swift' | 'rb') => {
  const header = {
    'User-Agent': 'Obsidian Code Emitter/0.1.0 (If this is not allowed, please let me know)',
    'Accept': 'application/json, text/plain, */*',
    'Accept-Language': 'en-US',
    'Content-Type': 'application/json',
  };
		
  const res = await fetch(url, {
    'headers': header,
    'body': JSON.stringify({
      'code': code,
      'codeId': null,
      'input': '',
      'language': lang
    }),
    'method': 'POST',
  });
  return (await res.json()) as {
    success: boolean,
    errors: string[],
    data: {
      sourceCode: number,
      status: number,
      errorCode: number,
      output: string,
      date: string,
      language: string,
      input: string,
    }
  };
};

const ruby_code = `
puts "Hello World12"
`;


console.log((await runCode(ruby_code, 'rb')).data.output);

License

This plugin sandbox contains codes from https://github.com/umijs/qiankun, which is licensed under

And other codes is licensed under

More Repositories

1

smartdns-rs

A cross platform local DNS server (Dnsmasq like) written in rust to obtain the fastest website IP for the best Internet experience, supports DoT, DoQ, DoH, DoH3.
Rust
547
star
2

obsidian-enhancing-export

This is an enhancing export plugin base on Pandoc for Obsidian (https://obsidian.md/ ). It's allow you to export to formats like Markdown、Markdown (Hugo https://gohugo.io/ )、Html、docx、Latex etc.
TypeScript
324
star
3

zerotier-edge

A lightweight(less than 5 MB) ZeroTier Controller Web UI for a self-hosted ZeroTier network controller that deployed at your edge.
TypeScript
51
star
4

candle-ext

An extension library to Candle that provides PyTorch functions not currently available in Candle
Rust
35
star
5

ngx-property-grid

A small and simple property grid in angular to view/edit POJOs, excellent if you have a "settings" object you want to give the user to edit.
TypeScript
17
star
6

cargo-patch-crate

Fix broken crates instantly 🏃🏽‍♀️💨
Rust
16
star
7

QuickGraph

C#
14
star
8

enum-flags

EnumFlags is a csharp like enum flags implementation.
Rust
7
star
9

pyiter

PyIter is a Python package for iterative operations inspired by the Kotlin、CSharp(linq)、TypeSrcipt and Rust . Enables strong **typing** and type inference for iterative operations.
Python
5
star
10

v2ray-maid

Automatically select the fastest server as V2ray Outbounds and update the config file.
Rust
5
star
11

pyodide-dist

CDN: https://cdn.jsdelivr.net/gh/mokeyish/[email protected] Used by https://github.com/mokeyish/obsidian-code-emitter
JavaScript
3
star
12

Latex-Equation-Editor

A LaTex Equation Online Editor.
JavaScript
3
star
13

Gym.ts

Gym for typescript, A toolkit for developing and comparing reinforcement learning algorithms.
TypeScript
2
star
14

ext.ts

language extensions for typescript
TypeScript
1
star
15

cargo-patch-crate-example

Rust
1
star
16

ngx-template

A strengthened angular template
HTML
1
star
17

ndArray.ts

ndarray for typescript
TypeScript
1
star
18

QuickGraph.ts

TypeScript
1
star