TextToDocument 1.0.1

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

// Install TextToDocument as a Cake Tool
#tool nuget:?package=TextToDocument&version=1.0.1

TextToDocument

<img src="Ttd.png" alt="TtD" height="150px" />

TextToDocument 是一个简单的富文本格式化语言 本类库将会帮助用户转换TtD文本为富文本

使用方法

直接调用 TtD.TextToDocument("文本") 即可

TtD语法

详细语法参见 TextState

TtD 使用 | 标记富文本, 标记后将会对后续的文本生效

例子:

|h1|这是个标题|p|
这是文本
这是|b|加粗|-b|文本
显示效果

<h1>这是个标题</h1> <p>这是文本</p> <p>这是<b>加粗</b>文本</p>

常用标签

标签 描述
|P| 清空所有富文本设置,使用默认值输出文本
|H1| 设置为1级标题 总共6级标题可设置
|B| 加粗文本
|I| 斜体文本
|R| 字体显示为红色

标签累加

标签可以进行累加 例如同时显示字体为红色和斜体则写为 |R||I|红色和斜体 <font color=#FF0000 >红色和斜体</font>

标签移除

在标签前面 添加 - 符号即可移除 之前应用的相应标签, p 则移除全部标签 例如 |R|红色|-R|黑色 显示为 <font color=#FF0000>红色</font>黑色

颜色混合

标签颜色支持混合成其他颜色 例如 |R3|颜色R3|G3|+G3|B3|+B3 <font color=#C00>颜色R3</font><font color=#CC0>+G3</font><font color=#CCc>+B3</font>

如何使用

  1. 通过Parckage Manager
Install-Package TextToDocument
  1. 通过nuget.org

    TextToDocument

  2. 下载nuget包

    Nuget文件夹

DEMO

Demo

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  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. 
.NET Core netcoreapp3.1 is compatible. 
.NET Framework net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has 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 87 3/27/2024
1.0.0 256 3/30/2022