TXTextControl.Markdown.Core
34.1.0-beta
Prefix Reserved
dotnet add package TXTextControl.Markdown.Core --version 34.1.0-beta
NuGet\Install-Package TXTextControl.Markdown.Core -Version 34.1.0-beta
<PackageReference Include="TXTextControl.Markdown.Core" Version="34.1.0-beta" />
<PackageVersion Include="TXTextControl.Markdown.Core" Version="34.1.0-beta" />
<PackageReference Include="TXTextControl.Markdown.Core" />
paket add TXTextControl.Markdown.Core --version 34.1.0-beta
#r "nuget: TXTextControl.Markdown.Core, 34.1.0-beta"
#:package TXTextControl.Markdown.Core@34.1.0-beta
#addin nuget:?package=TXTextControl.Markdown.Core&version=34.1.0-beta&prerelease
#tool nuget:?package=TXTextControl.Markdown.Core&version=34.1.0-beta&prerelease
TXTextControl.Markdown.Core
TXTextControl.Markdown.Core is a .NET 8 library that provides a public interface for converting between Markdown and TX Text Control content. It supports full documents, the current Selection, and SubTextPart content so you can work with entire documents or targeted fragments using the same API.
It works with:
TXTextControl.ServerTextControl(.NET, ASP.NET Core)TXTextControl.TextControl(WinForms)TXTextControl.WPF.TextControl(WPF)
Features
- Import Markdown into a full TX Text Control document
- Export a full TX Text Control document as Markdown
- Import Markdown into the current
Selection - Export the current
Selectionas Markdown - Import and export
SubTextPartcontent by passing the owning TX Text Control instance - Simple and intuitive API
- Improved Markdown fidelity for formatting, escaping, whitespace, and code blocks
Install
dotnet add package TXTextControl.Markdown.Core
Targets: net8.0
Namespace to import:
using TXTextControl.Markdown;
Quick start
Full document
// Server (ASP.NET Core / services)
using TXTextControl;
using TXTextControl.Markdown;
using var tx = new ServerTextControl();
tx.Create();
tx.LoadMarkdown("# Hello from Markdown");
string md = tx.SaveMarkdown();
// or:
tx.SaveMarkdown(out var mdOut);
Selection
Use Selection when you want to replace or export only the currently selected range instead of the whole document.
using TXTextControl;
using TXTextControl.Markdown;
using var tx = new ServerTextControl();
tx.Create();
tx.LoadMarkdown("# Title\n\nOld text");
tx.Select(9, 8); // selects "Old text"
tx.Selection.LoadMarkdown("**New text**");
string selectedMarkdown = tx.Selection.SaveMarkdown();
SubTextPart
Use SubTextPart when you want to load or save a reusable document fragment. For SubTextPart, pass the owning TX Text Control instance to LoadMarkdown and SaveMarkdown.
using TXTextControl;
using TXTextControl.Markdown;
using var tx = new ServerTextControl();
tx.Create();
// Get the current SubTextPart using your normal TX Text Control workflow.
var part = tx.SubTextParts.GetItem();
part.LoadMarkdown(tx, "## Reusable fragment\n\nThis content belongs to the SubTextPart.");
string partMarkdown = part.SaveMarkdown(tx);
Recent improvements and fixes
- Added support for working directly with the current
Selection - Added support for loading and saving Markdown in
SubTextPartcontent - Improved
SubTextPartreplacement so fragment updates are more reliable - Improved export of nested formatting such as bold + italic combinations
- Fixed strikethrough export so
~~text~~stays valid Markdown - Improved code block handling, including indented fenced code blocks
- Preserves intended whitespace more consistently during HTML-to-Markdown conversion
- Smarter escaping so regular punctuation is not over-escaped while Markdown syntax is still preserved
Requirements
- A TX Text Control instance at runtime (
ServerTextControl,TextControl, orWPF.TextControl), created by your app. - .NET
net8.0.
Trimming / AOT (NativeAOT, PublishTrimmed)
If you publish trimmed or AOT, reflection needs the TX Text Control members preserved. Options:
- Use the package as-is with its
buildTransitivetrimming descriptor (if included in your version). - Or add your own linker config to keep:
TXTextControl.StringStreamTypeTXTextControl.SaveSettings(propertyCssSaveMode)TXTextControl.CssSaveMode(valueInline)Load/Saveon your control types
Limitations
- Only basic Markdown features are supported including:
- Headings
- Paragraphs
- Horizontal rules
- Blockquote
- Lists
- Images
- Links
- Tables
Supported Styles
The following style names are supported and will be exported to Markdown. They get converted to the proper Markdown syntax. Inline formatting is additionally converted to Markdown.
Paragraph styles:
- BODY
- H1
- H2
- H3
- H4
- H5
- H6
- BLOCKQUOTE
Inline styles:
- TH
- PRE
- STRONG
- EM
- CAPTION
- CODE
- A
- KBD
- DEL
- S
- STRIKE
Style to Markdown Mapping
| Style | Markdown Syntax Example |
|---|---|
| BODY | Regular paragraph text |
| H1 | # Heading 1 |
| H2 | ## Heading 2 |
| H3 | ### Heading 3 |
| H4 | #### Heading 4 |
| H5 | ##### Heading 5 |
| H6 | ###### Heading 6 |
| BLOCKQUOTE | > Blockquote |
| TH | | Header | in tables |
| PRE | ```code block``` |
| STRONG / B | **Bold text** |
| EM / I / CAPTION | *Italic text* |
| CODE | `inline code` |
| A | [Link text](url) |
| KBD | `Ctrl+C` |
| DEL / S / STRIKE | ~~Strikethrough~~ |
Handling Different Style Names
When converting documents from formats such as DOCX, RTF, or HTML to Markdown, the style names in the source document may differ from the supported style names listed above.
In this case, you should map custom styles to supported Markdown styles before conversion.
For example:
- Map
Heading 1,Überschrift 1, orTitle1→H1 - Map
QuoteorCitation→BLOCKQUOTE - Map
Strong Emphasis→STRONG - Map
CaptionText→CAPTION(which is converted to italic Markdown)
This mapping can be done by:
- Normalizing style names in the TX Text Control document before calling
SaveMarkdown - Applying a custom mapping layer in your code that translates document-specific styles to the supported names
If a style is not mapped, it will be exported as plain text without Markdown formatting.
Versioning
This package binds to TX Text Control's public method and enum names. If those change in a future major TX Text Control release, update this package accordingly.
License
Redistribution and use in source and binary forms, with or without modification, are permitted with a valid license of TX Text Control.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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. 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. |
-
net8.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 |
|---|---|---|
| 34.1.0-beta | 44 | 4/14/2026 |
| 34.0.0 | 128 | 2/9/2026 |
| 33.0.0-beta.4 | 218 | 10/28/2025 |
| 33.0.0-beta.3 | 115 | 10/17/2025 |
| 33.0.0-beta.2 | 248 | 9/19/2025 |
| 33.0.0-beta.1 | 291 | 9/16/2025 |