MeshWeaver.Articles 2.0.3

dotnet add package MeshWeaver.Articles --version 2.0.3
                    
NuGet\Install-Package MeshWeaver.Articles -Version 2.0.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MeshWeaver.Articles" Version="2.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MeshWeaver.Articles" Version="2.0.3" />
                    
Directory.Packages.props
<PackageReference Include="MeshWeaver.Articles" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MeshWeaver.Articles --version 2.0.3
                    
#r "nuget: MeshWeaver.Articles, 2.0.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=MeshWeaver.Articles&version=2.0.3
                    
Install MeshWeaver.Articles as a Cake Addin
#tool nuget:?package=MeshWeaver.Articles&version=2.0.3
                    
Install MeshWeaver.Articles as a Cake Tool

MeshWeaver.Articles

Overview

MeshWeaver.Articles is a specialized component of the MeshWeaver ecosystem that provides functionality for article content management and rendering. This library enables applications to organize, load, and display Markdown-based articles from file system or other storage providers.

Features

  • Markdown-based article content management
  • Article collections for organizing content
  • Path-based article resolution
  • Built-in navigation capabilities
  • Catalog functionality for browsing articles
  • Resolve IArticleService for article operations
  • Integration with MeshWeaver UI components
  • Extensible storage providers for article content
  • Article metadata and properties support

Configuration

In appsettings.json

{
  "ArticleCollections": [
    {
      "Name": "Documentation",
      "DisplayName": "Documentation",
      "DefaultAddress": "app/Documentation",
      "BasePath": "../../modules/Documentation/MeshWeaver.Documentation/Markdown"
    },
    {
      "Name": "Northwind",
      "DisplayName": "Northwind",
      "DefaultAddress": "app/Northwind",
      "BasePath": "../../modules/Northwind/MeshWeaver.Northwind.ViewModel/Markdown"
    }
  ]
}

Configure in Services

// Register Article services
services.AddArticles(options => {
    options.AddFileSystemArticles(
        "Documentation",
        "Documentation",
        "app/Documentation",
        Path.Combine(GetAssemblyLocation(), "Markdown"));
    
    options.AddFileSystemArticles(
        "Samples",
        "Sample Articles",
        "app/Samples",
        Path.Combine(GetAssemblyLocation(), "Samples"));
});

// Configure with ArticleCollections from configuration
var configuration = new ConfigurationBuilder()
    .AddJsonFile("appsettings.json")
    .Build();

services.AddArticles(config => {
    configuration.GetSection("ArticleCollections")
        .Get<ArticleCollection[]>()
        ?.ToList()
        .ForEach(c => {
            config.AddFileSystemArticles(
                c.Name,
                c.DisplayName,
                c.DefaultAddress,
                c.BasePath);
        });
});

Usage Examples

Loading Articles

// Resolve IArticleService
public class ArticleViewer
{
    private readonly IArticleService _articleService;
    
    public ArticleViewer(IArticleService articleService)
    {
        _articleService = articleService;
    }
    
    // Load a specific article
    public async Task<ArticleContent> ViewArticleAsync(string path)
    {
        var article = await _articleService.GetArticleAsync(path);
        if (article == null)
            throw new ArticleNotFoundException(path);
            
        return article;
    }
    
    // Get article catalog
    public async Task<List<ArticleInfo>> GetCatalogAsync(string collection)
    {
        var catalog = await _articleService.GetCatalogAsync(collection);
        return catalog.Articles.ToList();
    }
}

From Tests

[Fact]
public async Task BasicArticle()
{
    // Get article by path
    var article = await ArticleService.GetArticleAsync($"{Test}/article");
    article.Should().NotBeNull();
    article.Content.Should().NotBeNull();
    article.Content.Should().Contain("Simple Test Article");
    article.Properties.Should().ContainKey("title");
    article.Properties["title"].Should().Be("Test Article");
}

[Fact]
public async Task Catalog()
{
    // Get catalog for a collection
    var catalog = await ArticleService.GetCatalogAsync(Test);
    catalog.Should().NotBeNull();
    catalog.Articles.Should().HaveCount(1);
    
    // Catalog contains article info
    var article = catalog.Articles.First();
    article.Title.Should().Be("Test Article");
    article.Path.Should().Be($"{Test}/article");
    
    // Get the article from catalog
    var articleContent = await ArticleService.GetArticleAsync(article.Path);
    articleContent.Should().NotBeNull();
    articleContent.Content.Should().Contain("Simple Test Article");
}

Key Concepts

  • Article Collections: Logical groupings of articles with metadata
  • Article Path: Hierarchical identifiers for articles
  • Article Catalog: Directory of available articles in a collection
  • Article Content: The rendered content and metadata of an article
  • Storage Providers: Backend systems that provide article content (file system, database, etc.)

Integration with MeshWeaver

  • Works with MeshWeaver.Layout for article rendering
  • Integrates with MeshWeaver navigation components
  • Supports MeshWeaver.Markdown for content processing

See Also

Refer to the main MeshWeaver documentation for more information about the overall project.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on MeshWeaver.Articles:

Package Downloads
MeshWeaver.Blazor

Package Description

MeshWeaver.Connection.Orleans

Package Description

MeshWeaver.Hosting.AzureBlob

Package Description

MeshWeaver.Hosting.PostgreSql

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.3 489 3/24/2025
2.0.2 463 3/24/2025
2.0.1 121 3/21/2025
2.0.0 154 3/20/2025
2.0.0-preview3 104 2/28/2025
2.0.0-Preview2 102 2/10/2025