wodeni / obsidian-penrose-plugin

A plugin for Obsidian that allows you to make diagrams with Penrose (https://penrose.cs.cmu.edu/).
MIT License
1 stars 1 forks source link

feat: substance metadata loading #4

Closed wodeni closed 5 months ago

wodeni commented 6 months ago

Description

Resolves #1

This PR adds a preprocessor of Substance that loads in metadata. For now, metadata can include style, domain, and variation. style and domain are paths to files in the current vault, and variation is any string.

Example

```penrose
-- style: venn.style
-- domain: setTheory.domain
-- variation: MonsoonCaterpillar95943
Set A, B, C, D, E, F, G

IsSubset(B, A)
IsSubset(C, A)
IsSubset(D, B)
IsSubset(E, B)
IsSubset(F, C)
IsSubset(G, C)

NotIntersecting(E, D)
NotIntersecting(F, G)
NotIntersecting(B, C)

AutoLabel All

![Screen Shot 2024-01-22 at 13 27 45](https://github.com/wodeni/obsidian-penrose-plugin/assets/11740102/6b611f16-5110-459a-b663-3ee0ed78a23d)

# Questions

* We can decide if we want to support: (1) `.style` and `.domain` files in the vault, (2) `.md` files with single code blocks, and/or (3) a single `.md` file with sections for style, domain, and variation. The disadvantage of (1) is that obsidian doesn't display non-markdown files by default.
* I wrote a simple regex for parsing the metadata entries, which is a bit brittle. A more robust solution would be awesome!