feat: add fileAppender parameter to GenMarkdownTreeCustom#2407
Open
algojogacor wants to merge 1 commit into
Open
feat: add fileAppender parameter to GenMarkdownTreeCustom#2407algojogacor wants to merge 1 commit into
algojogacor wants to merge 1 commit into
Conversation
Adds a fileAppender func(string) string parameter to GenMarkdownTreeCustom, allowing callers to append content (e.g., footers) to generated markdown files. Maintains backward compatibility through GenMarkdownTree which passes an empty string appender.
|
|
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.
This is an independent contribution submitted in a personal capacity and is not associated with any competition or organized event.
Summary
Add a
fileAppenderparameter toGenMarkdownTreeCustom, enabling callers to append content (such as footers or custom metadata) to generated markdown files — mirroring the existingfilePrependerbehavior.Root Cause
GenMarkdownTreeCustomaccepts afilePrepender func(string) stringthat writes content before the generated markdown, but there is no equivalent mechanism to append content after the markdown body. Users who need to inject footers must resort to post-processing the generated files.Closes: #1140
Fix
Added a
fileAppender func(string) stringparameter toGenMarkdownTreeCustom. The appender is called with the filename afterGenMarkdownCustomwrites the markdown content, following the same pattern asfilePrepender.GenMarkdownTreepassesemptyStrfor the new parameter (backward compatible)fileAppenderthroughTesting
go build ./doc/...compiles without errorsGenMarkdownTreebehavior is unchanged — the defaultemptyStrappender writes nothing