Products Technologies Demo Docs Blog Support Company

Introducing TXTextControl.Markdown.Core: Import and Export Markdown in TX Text Control

We are happy to announce the release of TXTextControl.Markdown.Core, a powerful new component that enables seamless import and export of Markdown files in TX Text Control. This addition enhances the versatility of TX Text Control, allowing developers to easily work with Markdown content in their applications.

Introducing TXTextControl.Markdown.Core: Import and Export Markdown in TX Text Control

Today, TX Text Control is releasing TXTextControl.Markdown.Core 33.0.0-beta.1, a .NET 8 library that introduces first-class support for Markdown, a lightweight markup format, to the TXTextControl world.

This means that with this package you can:

  • Import Markdown content into a TX Text Control document (whether ServerTextControl, WinForms, or WPF).
  • Export content from a TX Text Control document to Markdown. This includes text, paragraphs, styles, etc., which are converted to Markdown syntax.
  • Work with documents that originate in richer formats, such as DOCX, RTF, and HTML, and convert them to Markdown via TX Text Control. This allows you to move between rich document formats and markup. However, some style mapping may be necessary if the styles in the source documents do not match the style names supported by TX Text Control.

Key Features & Details

  • The package targets .NET 8.0.
  • It supports basic Markdown features: headings, paragraphs, horizontal rules, blockquotes, lists, images, links, tables.
  • There's a defined set of supported paragraph styles (BODY, H1-H6, BLOCKQUOTE) and inline styles (STRONG, EM, CODE, A, etc.). These get mapped to/from Markdown appropriately.

Style to Markdown Mapping

Below is a quick reference of the supported paragraph and inline style elements, their names, and their corresponding Markdown syntax:

<
Style Markdown Syntax Example
BODY Regular paragraph text BODY
H1 # Heading 1 H1
H2 ## Heading 2 H2
H3 ### Heading 3 H3
H4 #### Heading 4 H4
H5 ##### Heading 5 H5
H6 ###### Heading 6 H6
BLOCKQUOTE > Blockquote BLOCKQUOTE
TH | Header | in tables TH
PRE ```code block``` PRE
STRONG / B **Bold text** BOLD TEXT
EM / I / CAPTION *Italic text* Italic Text
CODE `inline code` inline code
A [Link text](url) Link text
KBD `Ctrl+C` Ctrl+C
DEL / S / STRIKE ~~Strikethrough~~ Strikethrough

Introduction

This tutorial shows how to use Visual Studio 2022 to create an .NET 8 console application that uses the ServerTextControl and MailMerge classes from TX Text Control .NET Server. The application is hosted in a Docker container using a Linux base image.

Prerequisites

You need to download and install the trial version of TX Text Control .NET Server.

Creating the Application

Make sure that you downloaded the latest version of Visual Studio 2022 that comes with the .NET 8 SDK.

  1. In Visual Studio 2022, create a new project by choosing Create a new project.

  2. Select Console App as the project template and confirm with Next.

  3. Enter a project name and choose a location to save the project. Confirm with Next.

  4. Choose .NET 8.0 (Long Term Support) as the Framework and confirm with Create.

    Creating the .NET 8 project

Adding the NuGet Packages

  1. In the Solution Explorer, select your created project and choose Manage NuGet Packages... from the Project main menu. Select Text Control Offline Packages as the Package source.

    Install the following package:

    • TXTextControl.TextControl.Core.SDK
  2. Select nuget.org as the Package source.

    Install the following package:

    • TXTextControl.Markdown.Core

    ASP.NET Core Web Application

Loading Markdown Content

  1. Find the Program.cs file in the Solution Explorer and replace the code with the following code snippet:

    using TXTextControl;
    using TXTextControl.Markdown;
    
    using var tx = new ServerTextControl();
    tx.Create();
    
    // Load markdown
    tx.LoadMarkdown("# Hello from Markdown");
    
    tx.Save("results.pdf", StreamType.AdobePDF);

Load a Markdown File

Create a Files folder in your project and add a Markdown file named sample.md with the following content:

# Markdown Parser Demo

Welcome to the **Markdown → HTML** demo.  
This file shows *most* of the common features your parser supports.

---

## Headings

# H1
## H2
### H3
#### H4
##### H5
###### H6

---

## Tables

| Item    | Qty | Price |
|---------|----:|------:|
| **Apples**  |   3 |  4.50 |
| Oranges |   2 |  3.20 |
| Bananas |   5 |  5.00 |
| **Total** |    | **12.70** |

---

## Paragraphs and Emphasis

This is a normal paragraph with *italic*, **bold**, and ***bold italic*** text.  
You can also have `inline code` in a sentence.

---

## Links and Images

Here is a link to [Text Control](https://www.textcontrol.com).  
Here is an image:  

![Text Control Logo](https://s1-www.textcontrol.com/0cdc0172/dist/img/corporate/tx-logo-inverse.svg "Text Control")

---

## Lists

Unordered list:
- Apples
- Oranges
  - Nested item
  - Another nested item
- Bananas

Ordered list:
1. First item
2. Second item
3. Third item with **bold**

---

## Blockquotes

> This is a blockquote.

Set the file's Copy to Output Directory property to Copy if newer.

Change the Program.cs code to load the sample.md file:

using TXTextControl;
using TXTextControl.Markdown;

using var tx = new ServerTextControl();
tx.Create();

var mdFile = File.ReadAllText("Files/sample.md");

// Load markdown
tx.LoadMarkdown(mdFile);

tx.Save("results.pdf", StreamType.AdobePDF);

The following screenshot shows the result when exporting the loaded Markdown file to PDF:

Markdown MD exported to PDF

Exporting Markdown

The following code snippet shows how to export loaded HTML content to a Markdown file:

using TXTextControl;
using TXTextControl.Markdown;

using var tx = new ServerTextControl();
tx.Create();

// sample html document with h1, h2, ul, p, strong and a sample table
var sampleHtml = @"<!DOCTYPE html><html lang=""en""><head><meta charset=""UTF-8""><meta name=""viewport"" content=""width=device-width, initial-scale=1.0""><title>Sample HTML</title></head><body><h1>Main Title</h1><h2>Subtitle</h2><p>This is a <strong>sample</strong> paragraph with a <a href=""https://example.com"">link</a>.</p><ul><li>First item</li><li>Second item</li><li>Third item</li></ul><table border=""1""><tr><th>Header 1</th><th>Header 2</th></tr><tr><td>Row 1 Col 1</td><td>Row 1 Col 2</td></tr><tr><td>Row 2 Col 1</td><td>Row 2 Col 2</td></tr></table></body></html>";

tx.Load(sampleHtml, StringStreamType.HTMLFormat);

string md = tx.SaveMarkdown();

Console.WriteLine(md);

This code snippets outputs the following Markdown content:

# Main Title

## Subtitle

This is a **sample** paragraph with a [link](https://example.com).

- First item
- Second item
- Third item

| Header 1 | Header 2 |
| ----- | ----- |
| Row 1 Col 1 | Row 1 Col 2 |
| Row 2 Col 1 | Row 2 Col 2 |

Why Markdown Matters Especially in the AI Era

Many document formats have come and gone over the years, ranging from proprietary binaries to verbose XML-based standards. In today's AI-driven world, lightweight markup formats, such as Markdown, are more relevant than ever. They strike the right balance between human readability and machine-friendly structure.

One of Markdown's biggest advantages is its ability to combine plain text with semantic structure. Headings, lists, tables, and links describe the logical flow of content, not just formatting. This structure is precisely what modern AI and large language models require to produce high-quality results.

When you give an AI system a DOCX or RTF file, the structure is technically present, but buried under layers of complex formatting. Converting these documents to Markdown reveals that structure, providing AI models with a much cleaner foundation. The result is more accurate summarization, better indexing, smarter searching, and higher-quality content generation.

In short, Markdown transforms documents into simple, structured, portable content that is ready for AI. This new release's ability to move seamlessly between DOCX, RTF, HTML, and Markdown is an important milestone for modern content workflows.

Conclusion

We are excited to see how developers will leverage TXTextControl.Markdown.Core to build smarter, AI-ready applications. Whether you are creating content management systems, document generation tools, or AI-powered writing assistants, this new package provides a solid foundation for working with Markdown in TX Text Control. We look forward to your feedback and seeing the innovative solutions you create.

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

ASP.NET

Integrate document processing into your applications to create documents such as PDFs and MS Word documents, including client-side document editing, viewing, and electronic signatures.

ASP.NET Core
Angular
Blazor
JavaScript
React
  • Angular
  • Blazor
  • React
  • JavaScript
  • ASP.NET MVC, ASP.NET Core, and WebForms

Learn more Trial token Download trial

Related Posts

ASP.NETASP.NET CoreConference

Text Control at NDC Copenhagen Developers Festival 2025

Last week, Text Control participated in the NDC Copenhagen Developers Festival 2025, a leading event for software developers and IT professionals in Scandinavia. We showcased our latest…


ASP.NETASP.NET Core

Creating Trusted Document Containers with PDF/A-3b in .NET C#

TX Text Control allows developers to do more than just generate PDFs. They can also build trusted digital archives that combine human-readable documents and machine-readable data in one secure,…


ASP.NETASP.NET Core

Best Practices for Image Compression when Exporting to PDF in .NET C#

When generating PDFs programmatically, one of the most important factors affecting file size and rendering performance is how images are embedded and compressed. This article explores best…


ASP.NETASP.NET CoreFiltering

Filtering and Sorting Repeating Blocks in MailMerge using C#

TX Text Control MailMerge's ability to filter and sort repeating merge blocks is a key strength, making it ideal for creating dynamic reports, lists, and catalogs.


ASP.NETASP.NET CoreConference

Text Control at NDC Copenhagen Developers Festival 2025

Join Text Control at the 2025 NDC Copenhagen Developers Festival, where we will present our newest innovations and solutions for document processing, reporting, and PDF generation. This unique…