ohm-engineering_obsidian-cs.../README.md

50 lines
1.4 KiB
Markdown
Raw Permalink Normal View History

2026-05-29 09:09:59 +00:00
# CSharp Snippet Runner
2026-05-28 14:12:18 +00:00
2026-06-01 14:22:19 +00:00
Obsidian plugin that adds a run button to C# code blocks. It uses [CSharpRepl](https://github.com/waf/CSharpRepl) to execute the snippets and displays the output directly in the note.
2026-05-28 14:12:18 +00:00
<img width="960" height="487" alt="Schermafbeelding 2026-05-29 110157" src="https://github.com/user-attachments/assets/233e5535-0cf4-4c75-ba27-8af9a36315ec" />
## Features
2026-05-28 14:12:18 +00:00
- Supports code blocks containing C# code with tags `csharp`, `cs`, `c#`, `net`, `.net` and `dotnet`
- Adds a **Run** button below each block with one of the above tags
- Runs snippets using bundled **CSharpRepl** auto-installed with `dotnet tool` into the plugin folder
- Supports optional script arguments
- Saves output and arguments per snippet in the plugin `responses` folder
- Restores saved output/arguments when notes are rendered
2026-05-28 14:12:18 +00:00
## Requirements
- Obsidian version >= 1.12.7
- [dotnet SDK](https://dotnet.microsoft.com/en-us/download) installed on your PC
## Usage
- Add a code snippet to your Obsidian note with one of these tags: `csharp`, `cs`, `c#`, `net`, `.net` or `dotnet`
- Optionally enter args
- Click `Run C#`
See [CSharpRepl](https://github.com/waf/CSharpRepl) on how to use with includes and nuget packages
## Development
2026-05-28 14:12:18 +00:00
```bash
npm install
npm run dev
```
2026-05-28 14:12:18 +00:00
## Build
2026-05-28 14:12:18 +00:00
```bash
npm run build
2026-05-28 14:12:18 +00:00
```
## Manual installation
2026-05-28 14:12:18 +00:00
Copy these files to:
2026-05-28 14:12:18 +00:00
`<Vault>/.obsidian/plugins/csharp-snippet-runner/`
2026-05-28 14:12:18 +00:00
- `main.js`
- `manifest.json`
- `styles.css`