Skip to content

Add @include directive support for splitting argdown across files - #18

Open
shamgang wants to merge 1 commit into
amdecker:masterfrom
shamgang:include-support
Open

shamgang wants to merge 1 commit into
amdecker:masterfrom
shamgang:include-support

Conversation

@shamgang

Copy link
Copy Markdown

Resolves @include(path) directives in argdown code blocks by recursively inlining the referenced vault file's contents before parsing, mirroring the @include syntax and semantics of @argdown/node's IncludePlugin so that argdown source is portable between the argdown-cli and Obsidian.

Also supports referencing normal Obsidian notes (.md) as include targets by extracting the contents of fenced ```argdown code blocks, since Obsidian's UI doesn't easily support creating bare .argdown files.

The main pitfall I see with this approach is that it duplicates @include resolution code that is also present in the argdown CLI. However, to properly share code, we would need to factor the recursive resolution logic into argdown/core. To get this new library, we'd need to update the argdown dependency in this repo, which has a major version change and requires some changes to how GraphViz is handled. I made all of these changes locally and they're in draft at shamgang/argdown#1 and shamgang#1. I've left them draft for now because I'm not sure if that next step is worth the trouble right now.

For context, I made this change because I want to model complex arguments in argdown that have composition - the same sub-claim is used in multiple higher-level arguments.

Resolves @include(path) directives in argdown code blocks by recursively
inlining the referenced vault file's contents before parsing, mirroring
the @include syntax and semantics of @argdown/node's IncludePlugin so
that argdown source is portable between the argdown-cli and Obsidian.

Also supports referencing normal Obsidian notes (.md) as include targets
by extracting the contents of fenced ```argdown code blocks, since
Obsidian's UI doesn't easily support creating bare .argdown files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant