-
Notifications
You must be signed in to change notification settings - Fork 273
Fix doc links (#884) #886
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix doc links (#884) #886
Conversation
I propose to don't do subdirectories @dtchepak WDYT? |
I'm not sure about this. 🤔 It is relying on github pages specific implementation right? I kind of like being able to do |
- move `/docs` to `/help` - remove dates from doc names - move docs to sub-directories and rename to index.md so we get nice urls (e.g. `help/example` rather than `help/example.html`. - use `wget --spider` to detect and fix broken links. - fix search rendering. Note: dark mode does not play nicely with the GCSE input box[1] [1]: https://support.google.com/programmable-search/
- include all doc *.md files in tests - name doc tests using directory name if file name is `index.*`.
@@ -37,7 +37,13 @@ public static string FormatCode(string code) | |||
|
|||
private static string GenerateTestsClassName(AdditionalText markdownFile) | |||
{ | |||
return $"Tests_{Path.GetFileNameWithoutExtension(markdownFile.Path).Replace("-", "_")}"; | |||
var file = Path.GetFileNameWithoutExtension(markdownFile.Path); | |||
var pathSegments = markdownFile.Path.Split(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can avoid manually working with paths
var fileName = Path.GetFileNameWithoutExtension(markdownFile.Path);
var directoryName = new FileInfo(markdownFile.Path).Directory.Name;
var nameToUse = string.Equals(fileName, "index", StringComparison.InvariantCultureIgnoreCase) ? directoryName : fileName;
return $"Tests_{nameToUse.Replace("-", "_")}";
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Applied suggestion 👍
If we need support other platforms then github pages - maybe this is fine |
There was a problem hiding this comment.
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 fixes and improves documentation links by moving content from the /docs to the /help directory, updating URL patterns, and adjusting tests accordingly.
- Update csproj file to recursively include markdown files from the new docs structure.
- Refactor test file name generation to accommodate renamed and reorganized documentation files.
- Update table of contents and link references to point to the new /help location and remove outdated docs.
Reviewed Changes
Copilot reviewed 10 out of 34 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
tests/NSubstitute.Documentation.Tests/NSubstitute.Documentation.Tests.csproj | Updated wildcard inclusion for markdown files in the new structure |
tests/NSubstitute.Documentation.Tests.Generator/DocumentationTestsGenerator.cs | Modified test class name generation to consider folder names |
docs/toc.yml | Updated links from docs/ to help/ |
docs/index.md | Added download sidebar and restructured the documentation home page |
docs/help/toc.yml | New table of contents for the help directory |
docs/help/search/index.md | New search page with Google CSE integration |
docs/help/creating-a-substitute/index.md | Updated link for "How NSubstitute works" for correct trailing slash |
docs/help.md | Updated links from /docs/ to /help/ |
docs/docs/toc.yml | Removed outdated table of contents for legacy docs |
docs/docs/2019-01-01-search.md | Deleted outdated search page |
tests/NSubstitute.Documentation.Tests.Generator/DocumentationTestsGenerator.cs
Outdated
Show resolved
Hide resolved
@Romfos could you merge this pr? Would be great to see the links working again. |
@304NotModified I don't have merge permission. We need wait @dtchepak for feedback |
Unfortunately I also don't have merge permission |
I think I've fixed this now @304NotModified and @Romfos 🤞 |
@dtchepak yes, I have it. Please deploy new version after fix |
Deployed ✔️ |
/docs
to/help
help/example
rather thanhelp/example.html
.wget --spider
to detect and fix broken links.