Skip to content

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

Merged
merged 3 commits into from
Jul 13, 2025
Merged

Fix doc links (#884) #886

merged 3 commits into from
Jul 13, 2025

Conversation

dtchepak
Copy link
Member

@dtchepak dtchepak commented Jun 9, 2025

  • 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 box1
  • rearrange home page to put install links at the top

@Romfos
Copy link
Contributor

Romfos commented Jun 13, 2025

I propose to don't do subdirectories
URLs without *.html works automatically. example: https://nsubstitute.github.io/docs/2010-02-10-replacing-return-values
Looks like this is local debug server bug
Make sense just remove dates because solution with index.html looks strange

@dtchepak WDYT?

@304NotModified 304NotModified removed their request for review June 16, 2025 20:38
@dtchepak
Copy link
Member Author

I propose to don't do subdirectories URLs without *.html works automatically. example: https://nsubstitute.github.io/docs/2010-02-10-replacing-return-values Looks like this is local debug server bug Make sense just remove dates because solution with index.html looks strange

@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 python3 -m http.server 8080 -d _site and have it be representative of what the real site will look like. If you feel strongly about it though i'm happy to update this PR as suggested 👍

dtchepak added 2 commits June 22, 2025 13:31
- 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);
Copy link
Contributor

@Romfos Romfos Jun 22, 2025

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("-", "_")}";

Copy link
Member Author

Choose a reason for hiding this comment

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

Applied suggestion 👍

@Romfos
Copy link
Contributor

Romfos commented Jun 22, 2025

I propose to don't do subdirectories URLs without *.html works automatically. example: https://nsubstitute.github.io/docs/2010-02-10-replacing-return-values Looks like this is local debug server bug Make sense just remove dates because solution with index.html looks strange
@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 python3 -m http.server 8080 -d _site and have it be representative of what the real site will look like. If you feel strongly about it though i'm happy to update this PR as suggested 👍

If we need support other platforms then github pages - maybe this is fine

@Romfos Romfos mentioned this pull request Jun 27, 2025
21 tasks
@Romfos Romfos requested a review from Copilot June 27, 2025 16:21
Copy link

@Copilot Copilot AI left a 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

@304NotModified
Copy link
Contributor

@Romfos could you merge this pr? Would be great to see the links working again.

@Romfos
Copy link
Contributor

Romfos commented Jul 6, 2025

@304NotModified I don't have merge permission. We need wait @dtchepak for feedback

@304NotModified
Copy link
Contributor

Unfortunately I also don't have merge permission

@dtchepak
Copy link
Member Author

@304NotModified I don't have merge permission. We need wait @dtchepak for feedback

I think I've fixed this now @304NotModified and @Romfos 🤞
Let me know if you still do not have permission.

@Romfos
Copy link
Contributor

Romfos commented Jul 13, 2025

@dtchepak yes, I have it. Please deploy new version after fix

@Romfos Romfos merged commit 314fe3c into nsubstitute:main Jul 13, 2025
8 checks passed
@dtchepak dtchepak deleted the fix-docs branch July 13, 2025 10:55
@dtchepak
Copy link
Member Author

Deployed ✔️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants