RemoveMarkdown.NET 1.0.0

dotnet add package RemoveMarkdown.NET --version 1.0.0
                    
NuGet\Install-Package RemoveMarkdown.NET -Version 1.0.0
                    
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="RemoveMarkdown.NET" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RemoveMarkdown.NET" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="RemoveMarkdown.NET" />
                    
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 RemoveMarkdown.NET --version 1.0.0
                    
#r "nuget: RemoveMarkdown.NET, 1.0.0"
                    
#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.
#:package RemoveMarkdown.NET@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=RemoveMarkdown.NET&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=RemoveMarkdown.NET&version=1.0.0
                    
Install as a Cake Tool

RemoveMarkdown.NET

NuGet

English | 中文

Introduction

RemoveMarkdown.NET is a .NET library that converts Markdown-formatted text to plain text.

Installation

Install via NuGet:

dotnet add package RemoveMarkdown.NET

Or via the Package Manager Console in Visual Studio:

Install-Package RemoveMarkdown.NET

Usage

using RemoveMarkdown;

string markdown = "# This is a heading\n\nThis is a paragraph with a [link](http://www.example.com/).";
string plainText = MarkdownRemover.Remove(markdown); // plainText becomes "This is a heading\n\nThis is a paragraph with a link."

Options:

using RemoveMarkdown;

string plainText = MarkdownRemover.Remove(markdown, new RemoveMarkdownOptions
{
    StripListLeaders = true,      // Remove list leaders (default: true)
    ListUnicodeChar = "",         // Character to replace list leaders with (default: "")
    SupportGitHubFavored = true,  // Support GitHub-Flavored Markdown (default: true)
    UseImgAltText = true,         // Replace images with alt text (default: true)
    RemoveAbbr = false,           // Remove abbreviations (default: false)
    ReplaceLinksWithURL = false,  // Replace links with URLs (default: false)
    HtmlTagsToSkip = new[] { "sub", "sup" },  // HTML tags to preserve (default: empty array)
    ThrowError = false            // Throw exceptions on errors (default: false)
});

Setting StripListLeaders to false will preserve list markers (*, -, +, (number).).

Features

  • Removing headers (ATX and Setext style)
  • Removing emphasis (* and _)
  • Removing links and images
  • Removing code blocks and inline code
  • Removing list markers
  • Removing horizontal rules
  • Removing blockquotes
  • Removing HTML tags (with option to preserve specific tags)
  • Support for GitHub-Flavored Markdown

Acknowledgements

Based on the remove-markdown Node.js module.

License

MIT


简介

RemoveMarkdown.NET 是将 Markdown 格式文本转为纯文本的 .NET 库

安装方法

通过 NuGet 安装:

dotnet add package RemoveMarkdown.NET

或在 Visual Studio 的包管理器控制台中:

Install-Package RemoveMarkdown.NET

使用方法

using RemoveMarkdown;

string markdown = "# 这是标题\n\n这是一个包含 [链接](http://www.example.com/) 的段落。";
string plainText = MarkdownRemover.Remove(markdown); // plainText 变为 "这是标题\n\n这是一个包含 链接 的段落。"

配置项:

using RemoveMarkdown;

string plainText = MarkdownRemover.Remove(markdown, new RemoveMarkdownOptions
{
    StripListLeaders = true,      // 是否移除列表前导符号 (默认: true)
    ListUnicodeChar = "",         // 替代移除的列表前导符号的字符 (默认: "")
    SupportGitHubFavored = true,  // 是否支持 GitHub 风格的 Markdown (默认: true)
    UseImgAltText = true,         // 是否用图片的 alt 文本替换图片 (默认: true)
    RemoveAbbr = false,           // 是否移除缩略语 (默认: false)
    ReplaceLinksWithURL = false,  // 是否用 URL 替换链接 (默认: false)
    HtmlTagsToSkip = new[] { "sub", "sup" },  // 不移除的 HTML 标签 (默认: 空数组)
    ThrowError = false            // 是否在出错时抛出异常 (默认: false)
});

StripListLeaders 设置为 false 将保留列表标记符号(*, -, +, (数字).)。

功能特性

  • 移除标题(ATX 和 Setext 风格)
  • 移除强调(* 和 _)
  • 移除链接和图片
  • 移除代码块和内联代码
  • 移除列表标记
  • 移除水平分隔线
  • 移除引用块
  • 移除 HTML 标签(可选择保留特定标签)
  • 支持 GitHub 风格的 Markdown

致谢

基于 remove-markdown Node.js 模块转写

许可证

MIT

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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.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.0 194 4/30/2025