Rewrite persistent output: reliably save results into the note (org-babel-style)#449
Open
nelsonlove wants to merge 6 commits into
Open
Rewrite persistent output: reliably save results into the note (org-babel-style)#449nelsonlove wants to merge 6 commits into
nelsonlove wants to merge 6 commits into
Conversation
…en the code block can't be located Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… render, not per execution Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ion start Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… completion Locates the block via the post-processor's getSectionInfo when available, falling back to matching the block's source text. Works in reading view, live preview, and for run- prefixed blocks; re-running replaces the output block instead of appending. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…output; hide live element once saved Reading view used to hide saved ```output blocks via CSS (a workaround for the old streaming write). Now that output is written once on completion, the saved block IS the result display — render it in all views, insert it with a blank line after the code block, and hide the ephemeral on-screen output element once the note has been updated. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jul 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The persistent output feature (saving a block's output into the note as an ```output block) currently relies on
view.previewMode.renderer.sectionsand streaming `editor.replaceRange` calls. In practice this fails silently in most contexts: reading view, live preview, and `run-` prefixed blocks all end up with output on screen but nothing saved to the note.This PR rewrites
FileAppenderaround two ideas:Vault.process()call. No editor dependency, so it works identically in reading view, live preview, and forrun-blocks.ctx.getSectionInfo()(threaded throughaddToAllCodeBlocksand fetched lazily at write time, since line numbers shift); fallback: scan the note for the fenced block whose body matches the block's source. Coversrun-blocks, where section info is unavailable.Re-running a block replaces its previous ```output block instead of appending, like org-babel's
#+RESULTS:. If the block genuinely can't be located (e.g. its source was edited since rendering), the user gets one Notice per run (builds on #448, whose commits are included here).Testing
npm run buildpasses. Manually verified in a live vault (macOS) with "Save output in note" enabled:run-prefixed block (previously always failed) → output saved via the fallback matcher🤖 Generated with Claude Code