An Obsidian plugin for rendering Asymptote drawings within notes.
Go to file
2023-08-06 09:35:04 +10:00
.gitignore initial commit 2023-08-06 09:35:04 +10:00
esbuild.config.mjs initial commit 2023-08-06 09:35:04 +10:00
main.ts initial commit 2023-08-06 09:35:04 +10:00
manifest.json initial commit 2023-08-06 09:35:04 +10:00
package-lock.json initial commit 2023-08-06 09:35:04 +10:00
package.json initial commit 2023-08-06 09:35:04 +10:00
README.md initial commit 2023-08-06 09:35:04 +10:00
styles.css initial commit 2023-08-06 09:35:04 +10:00
tsconfig.json initial commit 2023-08-06 09:35:04 +10:00
version-bump.mjs initial commit 2023-08-06 09:35:04 +10:00
versions.json initial commit 2023-08-06 09:35:04 +10:00

Obsidian Asymptote

An Obsidian plugin for rendering Asymptote drawings within notes.

Demo

# Asymptote Demo
This note shows how you can use Asymptote to draw images directly in notes.

See for example this picture:

```asy
unitsize(1cm);

path radius = (0, 0) -- (1 / sqrt(2), 1 / sqrt(2));
currentpen = currentpen + white;
// Shading
fill(unitcircle, p = colorless(currentpen) + opacity(0.2) + dashed + blue);
// Boundary
draw(unitcircle, p = colorless(currentpen) + dashed + red);
// Radius
draw(radius, green, L = scale(0.5) * Label("$r$"));
// Centre
dot((0, 0), L = scale(0.5) * Label("$x_0$"));
```

Building From Source

> npm i
> npm run build

Dependencies

Due to Asymptote not having any real support for use as a pure library, this plugin works by calling an Asymptote installation on a file created in the file system's temporary directory.

As such, this plugin is not standalone, and Asymptote must be installed.

Styling

Asymptote SVGs have their width and height properties stripped so that they can be independently styled using CSS. See styles.css for an example. In short, asy-rendered is the class of the div that directly wraps the child svg with the drawing itself.