Skip to content

feat: add fileAppender parameter to GenMarkdownTreeCustom#2407

Open
algojogacor wants to merge 1 commit into
spf13:mainfrom
algojogacor:feat/add-fileAppender-to-GenMarkdownTreeCustom
Open

feat: add fileAppender parameter to GenMarkdownTreeCustom#2407
algojogacor wants to merge 1 commit into
spf13:mainfrom
algojogacor:feat/add-fileAppender-to-GenMarkdownTreeCustom

Conversation

@algojogacor

Copy link
Copy Markdown

This is an independent contribution submitted in a personal capacity and is not associated with any competition or organized event.

Summary

Add a fileAppender parameter to GenMarkdownTreeCustom, enabling callers to append content (such as footers or custom metadata) to generated markdown files — mirroring the existing filePrepender behavior.

Root Cause

GenMarkdownTreeCustom accepts a filePrepender func(string) string that 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) string parameter to GenMarkdownTreeCustom. The appender is called with the filename after GenMarkdownCustom writes the markdown content, following the same pattern as filePrepender.

  • GenMarkdownTree passes emptyStr for the new parameter (backward compatible)
  • Recursive calls pass fileAppender through
  • Doc comment updated

Testing

  • go build ./doc/... compiles without errors
  • Existing GenMarkdownTree behavior is unchanged — the default emptyStr appender writes nothing

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.
@github-actions github-actions Bot added the area/docs-generation Generation of docs via Cobra label May 20, 2026
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docs-generation Generation of docs via Cobra

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GenMarkdownTreeCustom doesn't have a way to append a footer

2 participants