lynMarkdigRenderTest8 1.0.0
dotnet add package lynMarkdigRenderTest8 --version 1.0.0
NuGet\Install-Package lynMarkdigRenderTest8 -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="lynMarkdigRenderTest8" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add lynMarkdigRenderTest8 --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: lynMarkdigRenderTest8, 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.
// Install lynMarkdigRenderTest8 as a Cake Addin #addin nuget:?package=lynMarkdigRenderTest8&version=1.0.0 // Install lynMarkdigRenderTest8 as a Cake Tool #tool nuget:?package=lynMarkdigRenderTest8&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Introduction
Use txt2html to convert plain text files to the hypertext markup language (HTML).
Features:
- Clean and compliant HTML5
- Option to include your own CSS
- HTML entity replacement (optional; you can also edit the entity list). Note that critical entities (<,>,",&) are always replaced, so generally you don't have to enable this option
- Detects and fixes
_italic_
and*bold*
(optional) - Detects and marks URL's (optional)
- Supports specifying encoding
- Optional paragraph joining. Attempts to merge hard-coded line-breaks into coherent paragraphs. Lines shorter than specified length, which don't end with characters marking end of line ('.?!") are joined.
- Fast (v2 is more than 50x faster than v1!)
- Free and open source
- .NET Standard 2.0, meaning txt2html can be used with .NET Framework 4.6.1+, .NET Core 2.0 and more - see here for detailed information.
Examples
Full example
var conversionSettings = new ConversionSettings()
{ DetectUrls = true, FixBold = true, FixItalic = true, MinimumLineLength = 50, Title = "Lorem Ipsum"};
var text = new[]
{
"Lorem ipsum dolor sit amet,",
"consectetur adipiscing elit. ",
"Haec quo *modo* _conveniant_, non sane intellego.",
"Sed virtutem ipsam inchoavit, nihil amplius. ",
"",
"Non dolere, inquam, istud quam vim habeat postea videro; ",
"Duo Reges: constructio interrete. www.example.com. ",
"Sed quid sentiat, non videtis. At iste non dolendi status non vocatur voluptas."
};
var result = Converter.Convert(conversionSettings, text.ToList());
Methods
All described methods have async
counterparts, with method name being ConvertAsync()
instead of Convert()
.
//Using existing strings (IEnumerable<string>)
var result = Converter.Convert(settings, content);
//Specify the file to use as source, optionally specifying encoding (if omitted, .NET will attempt to auto-detect the encoding
var result = Converter.Convert(settings, @"d:\texts\Shakespeare.txt", Encoding.ASCII);
//Specify file stream to use as a source, and optional encoding. It is up to the caller to set the proper position in the file
//FileStream is not disposed.
FileStream fs = File.OpenRead(@"d:\texts\Shakespeare.txt");
fs.Position = 42;
var result = Converter.Convert(settings, fs, Encoding.Unicode);
//Convert text from stream reader
//Neither StreamReader nor base stream is disposed
StreamReader sr = new StreamReader(@"d:\texts\Shakespeare.txt")
var result = Converter.Convert(settings, sr);
Conversion settings
ConversionSettings.cs allows you to control various settings for text conversion.
bool FixBold
: Set to true to wrap the text between*asterisks*
with <strong>. Defaults to false.bool FixItalic
: Set to true to wrap the text between_underscores_
with <em>. Defaults to false.bool DetectUrls
: Detect and mark URLs. All www, http, https, ftp, news and file protocols/markers are supported.uint? MinimumLineLength
: Minimum line length to use for paragraph joining. Lines shorter than specified length, which don't end with characters marking end of line ('.?!") are joined. Defaults to null (joining disabled)bool CreateEntities
: Set to true to HTML entity replacement. Change txt2html.ent to specify what is changed. Note that critical entities (> < " &) are always replaced. If you don't include entities file (txt2html.ent), txt2html uses the embedded default entities list. Defaults to falsestring Css
: Include custom CSS to the conversion result. String should contain the actual CSS, not file path. Defaults to null (no special CSS)string Title
: Set the HTML title for conversion. Defaults to null (no title)
There are no supported framework assets in this 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.0 | 1 | 11/24/2020 |