FluentMarkdown 1.0.1

dotnet add package FluentMarkdown --version 1.0.1
                    
NuGet\Install-Package FluentMarkdown -Version 1.0.1
                    
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="FluentMarkdown" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FluentMarkdown" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="FluentMarkdown" />
                    
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 FluentMarkdown --version 1.0.1
                    
#r "nuget: FluentMarkdown, 1.0.1"
                    
#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=FluentMarkdown&version=1.0.1
                    
Install FluentMarkdown as a Cake Addin
#tool nuget:?package=FluentMarkdown&version=1.0.1
                    
Install FluentMarkdown as a Cake Tool

FluentMarkdown

Provides support for writing markdown documents in a fluent manner.

Getting Started

The MarkdownBuilder class is the entry point for creating markdown documents. It provides a fluent API for creating markdown documents.

var builder = new MarkdownBuilder();
builder
    .AddHeader(1, "Fluent Markdown")
    .AddParagraph("This is a paragraph of text.")
    .AddHeader("Another Header", 2)
    .AddParagraph("This is another paragraph of text.")
    .AddCodeBlock("csharp", "Console.WriteLine(\"Hello, World!\");")
    .AddUnorderedList(["First item", "Second item", "Third item"]);
    );

Text Formatting

The MarkdownBuilder class provides methods for adding text with some formatting options.

builder.AddTextBold("This text is bold.")
    .AddTextItalic("This text is italic.")
    .AddTextBoldItalic("This text is bold and italic.")
    .AddCode("This text is code.");

String extension methods are also provided for formatting text in a variety of ways.

builder.AddParagraph("Hello, World!".WithBold().WithItalic().WithStrikethrough());

The MarkdownBuilder class provides methods for adding links and images.

builder.AddLink("https://fluentmarkdown.com", "Fluent Markdown")
    .AddImage("https://placehold.co/600x400", "Placeholder");

String extension methods are also provided for adding links and images.

builder.AddParagraph("Google".WithLinkTo("https://www.google.com"));
builder.AddParagraph("https://placehold.co/600x400".AsImage().WithLinkTo("https://fluentmarkdown.com"));

Nested Elements

Some elements can be nested within others. For example, a paragraph can contain multiple child elements. Elements that can have child elements will have an overload that accepts a Action delegate.

builder.AddParagraph(p =>
{
    p.AddText("This is a paragraph with ");
    p.AddTextBold("bold");
    p.AddText(" text.");
});

Tables

Tables can be added to the document using the AddTable method.

var tableContent = new string[][]
{
    new string[] { "Row 1, Column 1", "Row 1, Column 2" },
    new string[] { "Row 2, Column 1", "Row 2, Column 2" }
};
builder.AddTable(tb => tb.WithHeader("Column 1", "Column 2")
                        .WithBody(tableContent));

Code Blocks

Code blocks can be added to the document using the AddCodeBlock() method.

builder.AddCodeBlock("Console.WriteLine(\"Hello, World!\");");

The language of the code block can be specified.

builder.AddCodeBlock("csharp", "Console.WriteLine(\"Hello, World!\");");

A default language can be set for all code blocks. This can be done at the builder instance level.

builder.UsingCodeLanguage(BlockLanguage.CSharp);

The default language can be set globally for all instances of MarkdownBuilder.

MarkdownConfiguration.Global.UsingCodeLanguage(BlockLanguage.CSharp);

Lists

Ordered and unordered lists can be added to the document using the AddOrderedList() and AddUnorderedList() methods.

builder.AddUnorderedList("First item", "Second item", "Third item");

Task lists can be added by leveraging the AddTaskListItem() method.

builder.AddUnorderedList(ul =>
{
    ul.AddTaskListItem("Task 1", true); // checked
    ul.AddTaskListItem("Task 2", false); // unchecked
});

Term1 : Definition1

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 142 3/13/2025
1.0.1-beta 69 2/25/2025