rust-lang / mdBook

Create book from markdown files. Like Gitbook but implemented in Rust
https://rust-lang.github.io/mdBook/
Mozilla Public License 2.0
18.37k stars 1.65k forks source link

Request for Support of .NET 8.0 Features Including Primary Constructors and File-Scoped Namespaces #2361

Open DLozanoNavas opened 7 months ago

DLozanoNavas commented 7 months ago

Problem

Hello MDBook Team,

I hope this message finds you well. I am currently utilizing MDBook for documenting our .NET projects and have recently started exploring the new features available in .NET 8.0. Notably, the introduction of Primary Constructors and File-Scoped Namespaces offers a streamlined and concise syntax that enhances the readability and maintainability of .NET applications.

However, I've encountered an issue where MDBook does not seem to support these new .NET 8.0 syntax features. Specifically, the Primary Constructors allow defining classes with a much cleaner syntax, and File-Scoped Namespaces reduce the nesting within files, both of which are beneficial for code clarity and organization.

Example

Here's an example demonstrating the new syntax:

using FenixAlliance.ABM.Models.DTOs.Components.Global.Currencies;
using FenixAlliance.ABM.SeedWork.ValueTypes;
using Microsoft.JSInterop;

namespace FenixAlliance.ABS.SDK.Clients;

public class ForexServiceClient(IJSRuntime jsRuntime) : PortalClient(jsRuntime)
{
    // Methods implementation
}

This syntax simplifies class definitions significantly and is something we are adopting widely within our projects.

Request

Could the MDBook team consider adding support for these .NET 8.0 features? This enhancement would greatly benefit .NET developers who are using MDBook for their documentation needs, allowing them to utilize all the latest language features without compatibility issues in their documentation workflow.

Thank you for considering this request. I am looking forward to your positive response and am happy to assist with testing or providing further examples if needed.

Best regards,

Daniel Lozano

Proposed Solution

No response

Notes

No response

ehuss commented 7 months ago

Unfortunately we are stuck on an older version of the syntax highlighting library we use. We'll either need to resolve https://github.com/rust-lang/mdBook/issues/1622 or switch to a new library such as https://github.com/rust-lang/mdBook/pull/1652.