Skip to content

Commit 0ebeb53

Browse files
committed
docs: improve readme
1 parent ed1b988 commit 0ebeb53

3 files changed

Lines changed: 97 additions & 85 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1515
### Changed
1616
- Fix typo in settings (Thanks to @Judro)
1717
- Fix F# support (Thanks to @SasaCetkovic)
18+
- Update the README.md to improve the overview over supported languages.
1819

1920
## [2.0.0]
2021
### Added

README.md

Lines changed: 95 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ The result is shown only after the execution is finished. It is not possible to
1616

1717
<hr></div>
1818

19-
The following [languages are supported](#supported-programming-languages-): C, CPP, Dart, Golang, Groovy, Kotlin, Java, JavaScript, TypeScript, Lean, Lua, CSharp, Prolog, Rust, Python, R, Ruby, Wolfram Mathematica, Haskell, Scala, Racket, F#, Batch, Shell & Powershell, Octave, Maxima, Zig and OCaml.
19+
The following [languages are supported](#supported-programming-languages-): C, C++, CSharp, Dart, F#, Golang, Groovy, Haskell, Java, JavaScript, Kotlin, Lean, Lua, Maxima, OCaml, Octave, Prolog, Python, R, Racket, Ruby, Rust, Scala, Shell (including Batch & Powershell), SQL, TypeScript, Wolfram Mathematica, Zig.
2020

2121
If you are new to MarkDown or Obsidian.md, you can go to the [Quickstart Guide](#quickstart-guide-) or take a look in to [some blogs and videos that feature this plugin](#featured-in)
2222

23-
Python, Rust, and Octave support embedded plots. All languages support ["magic" commands](#magic-commands-) that help you to access paths in obsidian or show images in your notes.
23+
Python, R, and Octave support embedded plots. All languages support ["magic" commands](#magic-commands-) that help you to access paths in obsidian or show images in your notes.
2424

2525
You can create code blocks that are executed before or after each code block of the same language and define [global code injections](#global-code-injection-and-reusing-code-blocks-).
2626

@@ -54,7 +54,7 @@ In blogs:
5454
<small>Are you featuring this plugin in your content? Let me know and I will add it here.</small>
5555

5656

57-
## Supported programming, typesetting languages 💻
57+
## Supported programming languages 💻
5858

5959
<details>
6060
<summary>JavaScript</summary>
@@ -85,28 +85,6 @@ console.log(message);
8585
```
8686
</details>
8787

88-
<details>
89-
<summary>CSharp</summary>
90-
91-
- Requirements: install dotnet core sdk and run in command line `dotnet tool install -g dotnet-script`, then config dotnet-script fullpath.
92-
93-
```cs
94-
Console.WriteLine("Hello, World!");
95-
```
96-
</details>
97-
98-
<details>
99-
<summary>Dart</summary>
100-
101-
- Requirements: dart sdk is installed and the correct path is set in the settings.
102-
103-
```dart
104-
void main() {
105-
print("Hello World");
106-
}
107-
```
108-
</details>
109-
11088
<details>
11189
<summary>Python</summary>
11290

@@ -121,7 +99,7 @@ if __name__ == "__main__":
12199
```
122100

123101
- By default, Python runs in Notebook Mode. You can turn this off in the settings.
124-
- Plots with matplotlib/seaborn are embedded in the note by default. You can turn this off in the settings.
102+
- Plots with matplotlib/seaborn are embedded in the note by default. You can turn this off in the settings. Note that plots are only embedded when `plt.show()` is called.
125103

126104
```python
127105
import seaborn as sns
@@ -159,6 +137,61 @@ plot(x, y, type="l")
159137
```
160138
</details>
161139

140+
<details>
141+
<summary>C++</summary>
142+
143+
- Requirements: [Cling](https://github.com/root-project/cling) is installed and correct path is set in the settings.
144+
- Code will be executed line-by-line without needing a main function.
145+
146+
```cpp
147+
#include <iostream>
148+
#include <string>
149+
150+
using namespace std;
151+
152+
void hello(string name) {
153+
cout << "Hello " << name << "!\n";
154+
}
155+
156+
hello("Alice);
157+
```
158+
159+
- Main functions can be used as an entrypoint by toggling the option in settings.
160+
161+
```cpp
162+
#include <iostream>
163+
164+
void main() {
165+
std::cout << "Hello, World!" << std::endl;
166+
}
167+
```
168+
</details>
169+
170+
<details>
171+
<summary>C</summary>
172+
173+
- Requirements: [Cling](https://github.com/root-project/cling) is installed and correct path is set in the settings.
174+
- Code will be executed line-by-line without needing a main function.
175+
176+
```c
177+
#include <stdio.h>
178+
179+
printf("Hello, World!");
180+
```
181+
182+
- Main functions can be used as an entrypoint by toggling the option in settings.
183+
184+
```c
185+
#include <stdio.h>
186+
187+
int main() {
188+
printf("Hello, World!");
189+
return 0;
190+
}
191+
```
192+
193+
</details>
194+
162195
<details>
163196
<summary>Java</summary>
164197

@@ -173,6 +206,15 @@ public class HelloWorld {
173206
```
174207
</details>
175208

209+
<details>
210+
<summary>SQL</summary>
211+
- Requirements: Have some SQL database installed and the correct path is set in the settings. The default is set to PostgreSQL (`psql`).
212+
- Make sure you adapt the settings to your database (`-d mydatabase -U myuser -f`)The default is set to .
213+
```sql
214+
SELECT * FROM table_name;
215+
```
216+
</details>
217+
176218
<details>
177219
<summary>LaTeX</summary>
178220

@@ -265,83 +307,56 @@ Explore [more LaTeX examples](https://antonpusch.de/latex), consult [package doc
265307

266308
</details>
267309

268-
<details>
269-
<summary>Lua</summary>
270-
271-
- Requirements: install lua and config lua path.
272310

273-
```lua
274-
print('Hello, World!')
275-
```
276-
</details>
277311

278312
<details>
279-
<summary>Lean</summary>
280-
281-
- Requirements: install lean and config lean path.
313+
<summary>More supported languages...</summary>
314+
<details>
315+
<summary>CSharp</summary>
282316

283-
```lean
284-
def main : IO Unit :=
285-
IO.println s!"Hello, World!"
317+
- Requirements: install dotnet core sdk and run in command line `dotnet tool install -g dotnet-script`, then config dotnet-script fullpath.
286318

287-
#eval main
288-
```
319+
```cs
320+
Console.WriteLine("Hello, World!");
321+
```
289322
</details>
290323

291324
<details>
292-
<summary>C++</summary>
293-
294-
- Requirements: [Cling](https://github.com/root-project/cling) is installed and correct path is set in the settings.
295-
- Code will be executed line-by-line without needing a main function.
296-
297-
```cpp
298-
#include <iostream>
299-
#include <string>
325+
<summary>Dart</summary>
300326

301-
using namespace std;
327+
- Requirements: dart sdk is installed and the correct path is set in the settings.
302328

303-
void hello(string name) {
304-
cout << "Hello " << name << "!\n";
329+
```dart
330+
void main() {
331+
print("Hello World");
305332
}
306-
307-
hello("Alice);
308333
```
334+
</details>
309335

310-
- Main functions can be used as an entrypoint by toggling the option in settings.
336+
<details>
337+
<summary>Lua</summary>
311338

312-
```cpp
313-
#include <iostream>
339+
- Requirements: install lua and config lua path.
314340

315-
void main() {
316-
std::cout << "Hello, World!" << std::endl;
317-
}
341+
```lua
342+
print('Hello, World!')
318343
```
319344
</details>
320345

321346
<details>
322-
<summary>C</summary>
347+
<summary>Lean</summary>
323348

324-
- Requirements: [Cling](https://github.com/root-project/cling) is installed and correct path is set in the settings.
325-
- Code will be executed line-by-line without needing a main function.
349+
- Requirements: install lean and config lean path.
326350

327-
```c
328-
#include <stdio.h>
351+
```lean
352+
def main : IO Unit :=
353+
IO.println s!"Hello, World!"
329354
330-
printf("Hello, World!");
355+
#eval main
331356
```
357+
</details>
332358

333-
- Main functions can be used as an entrypoint by toggling the option in settings.
334-
335-
```c
336-
#include <stdio.h>
337-
338-
int main() {
339-
printf("Hello, World!");
340-
return 0;
341-
}
342-
```
343359

344-
</details>
345360

346361
<details>
347362
<summary>Shell</summary>
@@ -586,16 +601,11 @@ print_endline "Hello, OCaml!"
586601
print("Hello, world!")
587602
```
588603
</details>
589-
604+
</details>
590605

591606
Squiggle: For Squiggle support take a look at the [Obsidian Squiggle plugin](https://github.com/jqhoogland/obsidian-squiggle) by @jqhoogland.
592607

593-
Support for the following is planned:
594-
595-
- Matlab
596-
- Julia Lang
597608

598-
Open for suggestions.
599609

600610
## Magic Commands 🪄
601611

@@ -612,6 +622,7 @@ The following magic commands are supported:
612622
- `@show(ImagePath, Width, Height)`: Displays an image at the given path in the note.
613623
- `@show(ImagePath, Width, Height, Alignment[center|left|right])`: Displays an image at the given path in the note.
614624
- `@html(HtmlSource)`: Displays HTML in the note
625+
- `@content`: Inserts the html content of the note in the code block. ([Here you find a nice example for the usage of this command.](https://github.com/twibiral/obsidian-execute-code/pull/390))
615626

616627
(`@show(...)` and `@html(...)` are only supported for JavaScript and Python yet.)
617628
(The old commands `@note` and `@vault` are still supported, but may be removed in the future.)

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "Execute Code",
44
"version": "2.0.0",
55
"minAppVersion": "1.7.2",
6-
"description": "Allows to execute code snippets within a note. Supported programming languages: C, CPP, Dart, Golang, Groovy, Kotlin, Java, JavaScript, TypeScript, Lean, Lua, CSharp, Prolog, Rust, Python, R, Ruby, Wolfram Mathematica, Haskell, Scala, Racket, F#, Batch, Shell & Powershell.",
6+
"description": "Allows you to execute code snippets within a note. Support C, C++, Python, R, JavaScript, TypeScript, LaTeX, SQL, and many more.",
77
"author": "twibiral",
88
"authorUrl": "https://www.github.com/twibiral",
99
"isDesktopOnly": true

0 commit comments

Comments
 (0)