Skip to content
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

feat: Allow extensionless URL HTML file access #10436

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

filzrev
Copy link
Contributor

@filzrev filzrev commented Nov 28, 2024

This PR is intended to add support for extensionless HTML URLs for docfx serve command.

Background
GitHub Pages support extensionless URLs. (e.g. https://dotnet.github.io/docfx/docs/basic-concepts)
And other static HTML hosting site also have similar features.

So I thought it's reasonable to support extensionless URLs with the docfx serve command.

Extensionless URL support is partially related to #2865.
It might be better to add options to output extensionless URLs for docfx internal links.

@filzrev filzrev changed the title feat: Allow extensionless HTML URL access feat: Allow extensionless URL HTML file access Nov 28, 2024
@filzrev filzrev force-pushed the feat-allow-extensionless-htmlurl branch from 58072f4 to 8cca247 Compare December 3, 2024 07:55
@@ -44,6 +48,7 @@ public static void Exec(string folder, string host, int? port, bool openBrowser,
Console.WriteLine($"Serving \"{folder}\" on {url}");
Console.WriteLine("Press Ctrl+C to shut down");
using var app = builder.Build();
app.UseExtensionlessHtmlUrl();
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be opt-in? I think the default behavior should remain a standard static file server so it can be hosted by a variety of web servers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This settings is works on docfx serve command only.
And not affect generated HTML files.

So I though it's not a problems by enabled default. (And not support config to disable)
When supporting feature that rewrite URL to extensionless URL automatically.
It should be supported as user's opt-in features.

@filzrev filzrev force-pushed the feat-allow-extensionless-htmlurl branch from 8cca247 to 0f2d784 Compare December 25, 2024 22:23
Copy link

codecov bot commented Dec 25, 2024

Codecov Report

Attention: Patch coverage is 0% with 20 lines in your changes missing coverage. Please review.

Project coverage is 79.28%. Comparing base (fe673ec) to head (307c9f4).
Report is 499 commits behind head on main.

Files with missing lines Patch % Lines
src/Docfx.App/RunServe.cs 0.00% 20 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10436      +/-   ##
==========================================
+ Coverage   74.31%   79.28%   +4.96%     
==========================================
  Files         536      547      +11     
  Lines       23189    23649     +460     
  Branches     4056     4065       +9     
==========================================
+ Hits        17234    18749    +1515     
+ Misses       4853     3730    -1123     
- Partials     1102     1170      +68     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

2 participants