feat: unified hybrid parsing — embed sub-nodes in any typed page#19
Merged
Conversation
b13a5f5 to
1461b1d
Compare
Merge the two parsing architectures into a single unified model: - New `src/parse-embedded.ts` module contains all shared body-parsing logic (headings, typed bullets, YAML blocks, anchors) used by both `readOstPage` and `readSpace`. - `read-ost-page.ts` now handles hybrid files (non-ost_on_a_page types): the page itself is added as a node, then embedded children are extracted from the body. - `read-space.ts` overhauled: all typed files (including ost_on_a_page) have their body parsed for embedded nodes. The `includePageFiles` option is removed — ost_on_a_page embedded nodes are always included. Embedded nodes get compound labels (`filename#title`) and parent refs use `[[filename]]` or `[[filename#title]]` format. - `validate.ts`: new `labelToKey` utility handles compound labels; node index supports `[[File#Section]]` and `[[File#^anchor]]` refs. - Anchor support: headings may end with ` ^anchorname`; anchors named after OST types (e.g. `^mission`, `^goal1`) also imply the node type. New fixtures and comprehensive tests for all hybrid scenarios. Co-authored-by: Roger Barnes <mindsocket@users.noreply.github.com>
- Restore readSpace to original: one node per file, ost_on_a_page files skipped (includePageFiles option retained). No embedded extraction in space mode, so a hybrid file is simply a regular typed node. - Remove labelPrefix from parse-embedded.ts; embedded nodes always get plain titles (e.g. "Our Mission"), not compound "filename#title" labels. - Update hybrid_solution.md fixture: parent now references the vision file directly ([[hybrid_vision]]) instead of a non-existent embedded node. - Update tests to reflect 7 nodes in valid-ost space (was 9 with embedded), rewrite hybrid section to assert no embedded extraction in space mode, and remove compound-label test cases from validate tests. Addresses owner feedback on issue #10.
readSpace now correctly extracts embedded child nodes from hybrid typed
pages (unchanged from original intent), while still skipping ost_on_a_page
files as before. The previous commit incorrectly removed the extraction
entirely.
Embedded nodes get plain resolved titles ("Embedded Mission" not
"hybrid_vision#Embedded Mission"), so parent refs use simple wikilinks:
[[hybrid_vision]] for the file, [[Embedded Mission]] for the embedded node.
Update hybrid_solution.md and tests accordingly.
1461b1d to
4ebd7e0
Compare
mindsocket
commented
Feb 26, 2026
Owner
Author
mindsocket
left a comment
There was a problem hiding this comment.
I think we're on the right track but there are some issues of interpretation of the requirements , especially around handling hierarchy (parent links, in-page anchors and resolved titles).
…r resolution - readOstOnAPage (was readOstPage) now strictly handles ost_on_a_page files; throws if given a typed node file. All callers updated. - OstPageReadResult → OstOnAPageReadResult in types.ts - includePageFiles → includeOnAPageFiles on readSpace options - OstNode gains sourceFile?: string; readSpace sets it on embedded nodes so validate can resolve [[file#^anchor]] parent refs - validate.ts indexes by data.title (resolved title) instead of labelToKey(label); anchor keys use "sourceFile#^anchor" pattern - isHybridMode renamed to isOnAPageMode with inverted logic in parse-embedded.ts - Fixture files renamed: hybrid_vision→vision_page, hybrid_solution→solution_page, hybrid-anchor-type→anchor_vision. "hybrid" terminology removed from all comments, test describes, and fixture references. - Tests: read-ost-page.test.ts → read-ost-on-a-page.test.ts (typed-file rejection test added). read-space.test.ts covers anchor-type inference and sourceFile assignment. validate.test.ts covers cross-file [[file#^anchor]] resolution with synthetic nodes.
mindsocket
commented
Feb 27, 2026
Owner
Author
mindsocket
left a comment
There was a problem hiding this comment.
My feedback is mostly on one particular topic, originating with the comment on tests/fixtures/valid-ost/solution_page.md with supporting thoughts through other files.
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.
Implements issue #10: Support "embedding" of subitems at any level.
Key changes:
src/parse-embedded.tswith shared body-parsing logicreadOstPagesupports hybrid files (typed pages with embedded children)readSpaceextracts embedded nodes from all typed files; removesincludePageFilesoptionvalidate.tshandles[[File#Section]]and[[File#^anchor]]parent refs^mission,^goal1)Closes #10
Generated with Claude Code