Add private gallery module page generation#394
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cce3e68892
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| var slug = Slugify(package.Name); | ||
| var moduleDir = Path.Combine(outputDirectory, slug); | ||
| Directory.CreateDirectory(moduleDir); |
There was a problem hiding this comment.
Disambiguate module output directories
Generate uses Slugify(package.Name) as the module folder key, so two distinct package names that normalize to the same slug (for example Contoso.Tools and Contoso-Tools) will write to the same index.md path and silently overwrite one module page with the other. This causes broken/ambiguous module navigation in the generated site whenever a feed contains such names.
Useful? React with 👍 / 👎.
| var docSlug = Slugify(FirstNonEmpty(doc.Title, Path.GetFileNameWithoutExtension(doc.Path), doc.Id, "document")!); | ||
| var docDir = Path.Combine(outputDirectory, $"{moduleSlug}-{docSlug}"); | ||
| Directory.CreateDirectory(docDir); |
There was a problem hiding this comment.
Ensure generated doc page paths are unique per document
Document page directories are based only on moduleSlug plus a slugified title/path stem, so multiple module docs that share the same title (common with files like README.md or repeated headings) resolve to the same folder and overwrite each other. In that case the later document wins and earlier content becomes unreachable even though both entries are listed.
Useful? React with 👍 / 👎.
| var outputDirectory = ResolvePath(baseDir, | ||
| GetString(step, "out") ?? | ||
| GetString(step, "output") ?? | ||
| GetString(step, "outputDirectory") ?? | ||
| GetString(step, "output-directory") ?? |
There was a problem hiding this comment.
Validate raw output path before resolving it
This resolves the configured output path before checking whether it was provided, so an explicit empty value like "out": "" resolves to baseDir instead of being rejected. The generator then calls ResetDirectory(outputDirectory), which recursively deletes that directory; with this input it can wipe the site/repo root rather than just generated module content.
Useful? React with 👍 / 👎.
| private static string EscapeYaml(string? value) | ||
| => (value ?? string.Empty).Replace("\\", "\\\\", StringComparison.Ordinal).Replace("\"", "\\\"", StringComparison.Ordinal); |
There was a problem hiding this comment.
Escape newline characters in YAML front matter values
Front-matter fields are wrapped in double quotes, but EscapeYaml only escapes backslashes and quotes; it leaves raw \r/\n characters intact. If a module title/description contains line breaks (common in package metadata), the generated header becomes invalid YAML and page parsing can fail for that module.
Useful? React with 👍 / 👎.
cce3e68 to
b0efba9
Compare
Summary
portal-module-pagespipeline task that turns private-gallery/feed JSON plus portal docs JSON into static Markdown module pagesValidation