fix: support re-aggregating docforge output as input (round-trip)#486
Merged
Conversation
Root-absolute links (e.g. /docs/x.png) emitted by a previous docforge run were resolved against the repo root on re-aggregation, dropping the prefix that was stripped during the original aggregation. Embedded images hard-failed, normal links only warned. ReAnchorRootAbsolute reconstructs the stripped prefix deterministically from the source resourcePath up to and including the first configured structural dir, and both link callers apply it before ResolveRelativeLink.
editThisPage overwrote origin-identity frontmatter (github_repo, github_subdir, path_base_for_github_subdir, params.github_branch) that a re-aggregated file already carried from its original aggregation. MergeDocumentAndNodeFrontmatter now keeps an already-present source-file value field-wise (original wins). weight/prev/next keep refreshing as they describe the current site tree, not origin identity.
The package-level var tripped the gochecknoglobals linter. The keys are read in a single place, so scope them locally instead. Also drops the numbered case comments in the reanchor table test (Entry names describe them).
Contributor
|
/lgtm |
|
LGTM label has been added. DetailsGit tree hash: d3d9b557a95d68f1b87229982f9cdfba0967d98a |
VelmiraS
marked this pull request as ready for review
July 21, 2026 14:27
|
[APPROVALNOTIFIER] This PR is APPROVED Approval requirements bypassed by manually added approval. This pull-request has been approved by: VelmiraS The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
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.
How to categorize this PR?
/kind enhancement
What this PR does / why we need it:
Unblocks feeding already-transformed, committed docforge output back into docforge (round-trip). Two independent fixes:
/docs/x.png) emitted by a previous run were resolved against the repo root on re-aggregation, dropping the prefix docforge stripped during the original aggregation. Embedded images hard-failed, normal links only warned. NewReAnchorRootAbsolutereconstructs the stripped prefix deterministically from the sourceresourcePathup to and including the first configured structural dir; both link callers apply it beforeResolveRelativeLink.URL.ResolveRelativeLinkis untouched.editThisPageoverwrote origin-identity frontmatter (github_repo,github_subdir,path_base_for_github_subdir,params.github_branch) that a re-aggregated file already carried.MergeDocumentAndNodeFrontmatternow keeps an already-present source-file value field-wise (original wins).weight/prev/nextkeep refreshing as they describe the current site tree, not origin identity.Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
reanchor_test.go,document_worker_test.go,frontmatter_test.go); the integration test reproduces the original embed hard-fail blocker.MergeDocumentAndNodeFrontmatter, the only place with both frontmatters.Release note: