Skip to content

docs: support cross-repo README substitution for aweXpect Migration page#29

Merged
vbreuss merged 1 commit into
mainfrom
docs/migration-page
May 3, 2026
Merged

docs: support cross-repo README substitution for aweXpect Migration page#29
vbreuss merged 1 commit into
mainfrom
docs/migration-page

Conversation

@vbreuss

@vbreuss vbreuss commented May 3, 2026

Copy link
Copy Markdown
Member

Add ExtraReadmes config on DocsSource so a slice can pull a foreign repo's README and substitute it into a named target file. New StripReadmeFront helper handles READMEs without ## headings (drops H1, consecutive badge lines, and surrounding blanks).

The aweXpect slice now pulls aweXpect.Migration's README and inlines it into 09-migration.md, giving the rendered Migration page a single source of truth.

Add ExtraReadmes config on DocsSource so a slice can pull a foreign
repo's README and substitute it into a named target file. New
StripReadmeFront helper handles READMEs without ## headings (drops H1,
consecutive badge lines, and surrounding blanks).

The aweXpect slice now pulls aweXpect.Migration's README and inlines
it into 09-migration.md, giving the rendered Migration page a single
source of truth.
@vbreuss vbreuss self-assigned this May 3, 2026
@vbreuss vbreuss added the documentation Improvements or additions to documentation label May 3, 2026
Copilot AI review requested due to automatic review settings May 3, 2026 11:52
@vbreuss
vbreuss merged commit 7ea701e into main May 3, 2026
4 checks passed
@vbreuss
vbreuss deleted the docs/migration-page branch May 3, 2026 11:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the docs aggregation pipeline so a docs slice can substitute README content from a different repository into one of its generated pages. In practice, it uses that new mechanism to make the aweXpect Migration page pull its body from the aweXpect.Migration repository, keeping that content as the single source of truth.

Changes:

  • Adds ExtraReadmes / ReadmeSubstitution support to DocsSource for cross-repo README injection.
  • Implements FetchReadmeBody and StripReadmeFront to fetch a foreign README.md and remove its leading title/badge section.
  • Configures the aweXpect slice to inline aweXpect.Migration's README into 09-migration.md.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Pipeline/Build.Pages.cs
Comment on lines +128 to +150
Func<string, string, string>? transformer = (source.InlineReadme || extraReadmes.Count > 0)
? (name, content) =>
{
if (name.StartsWith("00-", StringComparison.Ordinal) &&
if (source.InlineReadme &&
name.StartsWith("00-", StringComparison.Ordinal) &&
content.Contains("{README}", StringComparison.Ordinal))
{
string substitution = readmeContent.Replace("Docs/pages/", "./", StringComparison.Ordinal);
content = content.Replace("{README}", substitution, StringComparison.Ordinal);
readmeContent = string.Empty; // substitute into the first match only
Log.Information($" Inlined README.md into {name}");
}
for (int i = 0; i < extraReadmes.Count; i++)
{
(ReadmeSubstitution cfg, string body) = extraReadmes[i];
if (string.IsNullOrEmpty(body))
{
continue;
}
if (string.Equals(name, cfg.TargetFileName, StringComparison.Ordinal) &&
content.Contains(cfg.Placeholder, StringComparison.Ordinal))
{
content = content.Replace(cfg.Placeholder, body, StringComparison.Ordinal);
Comment thread Pipeline/Build.Pages.cs
Comment on lines +143 to +146
if (string.IsNullOrEmpty(body))
{
continue;
}
Comment thread Pipeline/Build.Pages.cs
Comment on lines +52 to +56
record ReadmeSubstitution(
string Organization,
string Repository,
string TargetFileName,
string Placeholder = "{README}");
Comment thread Pipeline/Build.Pages.cs
Comment on lines +118 to +125
List<(ReadmeSubstitution Config, string Body)> extraReadmes = new();
if (source.ExtraReadmes != null)
{
foreach (ReadmeSubstitution sub in source.ExtraReadmes)
{
string body = await FetchReadmeBody(client, sub.Organization, sub.Repository);
extraReadmes.Add((sub, body));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants