Replies: 2 comments 3 replies
-
|
I've been thinking about this, too, actually; so I'm thrilled that you're also interested in that kind of capability and bet we can together come up with a great way of making that possible! There are always trade-offs, and I know the solution I've been thinking about has them just like everything else; so don't read this as me saying I am committed to a particular path already, but I'd like to talk over my approach, too, just so we have as many options on the table as possible. My very early thoughts around this were that maybe we could give URL routes to document sub-parts. In the example you gave above, that might be: GET /vault/project/notes.md/heading/Design%20Noteswhere This has some pros:
& some cons:
as I'm talking this through, it also seems like these two approaches for GET-ing sub-parts of a document are probably not mutually exclusive, and I could probably be convinced into supporting both options. Footnotes
|
Beta Was this translation helpful? Give feedback.
-
|
For those following along, the features @grimlor & I were discussing here were released as part of 3.6.0 ! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
The REST API already supports targeted writes via PATCH v3 — you can append/prepend/replace content at a specific heading, block reference, or frontmatter field using the
Target-TypeandTargetheaders. And you can discover those targets by requesting the document map viaAccept: application/vnd.olrapi.document-map+jsonon GET.What's missing is the read side: there's no way to GET just the content of a specific section. If you want to read what's under
## Design Notes, you have to fetch the entire document and parse it yourself — even though the server already has thegetDocumentMapinfrastructure to locate that content.Proposal: Allow the existing GET endpoints (
/vault/*,/active/,/periodic/...) to accept the sameTarget-Type,Target, andTarget-Delimiterheaders that PATCH v3 already uses. When present, the response body would contain only the targeted section's content instead of the whole file. No new endpoints or content types needed.Quick example:
→ Returns only the text under the
## Design Notesheading.This would reuse the
getDocumentMapfrommarkdown-patchthat's already imported for PATCH v3, so the implementation surface is small. It would also be consistent with the existing header-based targeting pattern — same headers, same semantics, just on GET instead of PATCH.Use case: AI agents and tools that work with large documents benefit from reading specific sections without transferring and re-parsing the full file. The document map GET already lets you discover what sections exist; this would let you read what's in a specific one.
Happy to submit a PR with tests if this sounds like a good direction.
Beta Was this translation helpful? Give feedback.
All reactions