|
| The HTML to Markdown Converter is a component of the
HiQPdf Next Library for .NET
that converts a web page given by its URL or an HTML code to Markdown text. The page is first loaded with its CSS and JavaScript,
then its headings, lists, tables, links and images are written in Markdown.
You can see the list of
all HiQPdf Next components
on the library page.
|
|
| The HTML to Markdown Converter is distributed as part of the
HiQPdf Next HTML to PDF Converter for .NET,
which also includes functionality for converting HTML to PDF and HTML to images.
|
|
Compatibility Platforms
|
|
| HiQPdf Next for .NET can run on a variety of Windows, Linux and macOS platforms in web, console and
desktop applications across all modern .NET platforms.
The library components can be used in Azure App Service and Azure Functions environments
on both Windows and Linux. Deployment to Docker Windows and Linux containers is also supported.
|
|
| The .NET library targets .NET Standard 2.0, which makes it compatible with a wide range of .NET Core and .NET Framework
applications.
|
|
Getting Started
|
|
| The online documentation
contains Getting Started guides for Windows, Linux, macOS, Azure App Service and Azure Functions,
with detailed instructions for integrating the library into your application and complete C# examples
for each important feature of the library.
|
|
| You can see the current capabilities of the library by checking the
online demo application for this library
and the API reference in the online documentation.
|
|
Download Demo Application
|
|
| You can also download a free trial package for .NET, which includes
an ASP.NET demo application project with complete C# source code as a starting point for experimenting with your own usage scenarios.
|
|
| Running the samples in the demo application that involve HTML to PDF conversion features on Linux platforms
might require installing some system dependency packages.
The documentation includes an entire section dedicated to building, publishing and running the demo application on multiple platforms.
|
|
NuGet Packages
|
|
| For Windows x64 deployments add a reference to the
HiQPdf.Next.HtmlToPdf.Windows
NuGet Package and for Linux x64 deployments add a reference to the
HiQPdf.Next.HtmlToPdf.Linux
NuGet Package. The packages without an architecture suffix target x64.
|
|
| For Windows ARM64 and Linux ARM64 deployments add a reference to the
HiQPdf.Next.HtmlToPdf.Windows.Arm64
and
HiQPdf.Next.HtmlToPdf.Linux.Arm64
NuGet Packages respectively.
|
|
| For macOS on Apple Silicon (ARM64) deployments add a reference to the
HiQPdf.Next.HtmlToPdf.MacOS
NuGet Package.
|
|
| The package for Windows is referenced by the
HiQPdf.Next.Windows
metapackage for all components, the package for Windows ARM64 is referenced by the
HiQPdf.Next.Windows.Arm64
metapackage for all components, the package for Linux is referenced by the
HiQPdf.Next.Linux
metapackage for all components, the package for Linux ARM64 is referenced by the
HiQPdf.Next.Linux.Arm64
metapackage for all components and the package for macOS is referenced by the
HiQPdf.Next.MacOS
metapackage for all components.
|
|
| There are also multiplatform metapackages that reference both the Windows x64 and Linux x64 HTML to PDF packages:
HiQPdf.Next.HtmlToPdf
for the HTML to PDF functionality and
HiQPdf.Next
for the entire HiQPdf Next library.
|
|
Installation
|
|
| The HTML to Markdown Converter runs on the platform specific runtime of the HTML to PDF Converter component.
On Windows and macOS platforms, the runtime generally does not require the installation of additional dependencies.
On Linux platforms installing some system dependency packages might be necessary, depending on the exact version of Linux you are using.
In online documentation in
the Getting Started and Publish guides you can find instructions about Linux dependencies installation on a variety of Linux platforms.
|
|
HiQPdf.Next Namespace
|
|
| All components of the HiQPdf Next for .NET library share the same
HiQPdf.Next
namespace and can be used together in the same application.
To use the library in your own code, add the using directive at the top of your C# source file, as shown below.
|
|
// Include the HiQPdf.Next namespace at the top of your C# file
using HiQPdf.Next;
|
|
|
|
Sample Code
|
|
| After you add the reference to the NuGet package to your project, use the sample code below to convert a web page and an HTML code to Markdown.
|
|
// Create the HTML to Markdown converter instance with default options
HtmlToMarkdown htmlToMarkdownConverter = new HtmlToMarkdown();
// Convert a web page to Markdown
string markdown = htmlToMarkdownConverter.ConvertUrlToMarkdown("https://www.hiqpdf.com");
// Convert an HTML code to Markdown, with a base URL for its links and images
string markdownFromHtml = htmlToMarkdownConverter.ConvertHtmlToMarkdown(htmlCode, baseUrl);
|
|
|
|
Features List
|
|
| HiQPdf Next HTML to Markdown Converter for .NET offers options for selecting the content written in Markdown and for controlling how the HTML page is loaded.
You can convert only a part of the page, exclude elements, choose how the links and images are written
and wait for the content of the page before the conversion starts.
|
|
|
Convert a URL or an HTML Code to Markdown
|
| You can convert a web page given by its URL or an HTML code given as a string, with a base URL used to resolve the links and images.
The result is a .NET string with the Markdown text or a Markdown file.
|
|
|
|
Headings, Lists, Tables and Code Blocks
|
| The headings, paragraphs, lists, tables, quotes and code blocks of the HTML page are written with the Markdown syntax, in the order they have in the page.
|
|
|
|
Options for Links and Images
|
| The links are written as Markdown links or only with their text. The images can be written with their URL,
with the source they have in the HTML page, embedded in the Markdown text or left out.
|
|
|
|
Convert Only a Part of the Page
|
| A CSS selector gives the elements of the page that are converted, for example the main article.
Another CSS selector gives the elements to leave out, such as menus, side bars and footers.
|
|
|
|
Wait for the Content of the Page
|
| The conversion can start when the page is loaded, after a time interval or when an element given by a CSS selector is found in the page.
This helps with pages that load their content from JavaScript.
|
|
|
|
HTTP Headers, Cookies and Authentication
|
| You can send custom HTTP headers and cookies with the request for the web page and set the credentials for pages that require authentication.
The page can also be requested through a proxy server.
|
|
|
|
Asynchronous Convert Methods
|
| There are asynchronous variants of the convert methods with the Async suffix that can be used with async and await.
|
|
|
|
Available on Windows, Linux and macOS Platforms
|
| HiQPdf Next for .NET can run on Windows (x64 and ARM64), Linux (x64 and ARM64) and macOS (Apple Silicon / ARM64).
There are different NuGet packages for Windows, Linux and macOS, including the same .NET library but with different
native runtimes. For Windows, the minimum required version is Windows 10 or Windows Server 2016.
|
|
|
|
Built for .NET Standard 2.0 for Maximum Compatibility
|
| The .NET library targets .NET Standard 2.0, making it compatible
with a wide range of .NET Core and .NET Framework applications. It is compatible with
.NET 11.0, 10.0, 9.0, 8.0, 7.0, 6.0, .NET Standard 2.0 and .NET Framework 4.6.2 to 4.8.1.
|
|
|
|
Fully Compatible with Azure App Service and Azure Functions on Both Windows and Linux
|
| The converter can run without restrictions in your Azure App Service and Azure Functions
.NET Core applications targeting both Windows and Linux platforms. Web fonts and other features are fully supported
by HiQPdf Next for .NET.
Online documentation offers detailed usage instructions for Azure applications targeting both Windows and Linux.
|
|
|
|
NuGet Packages for Windows, Linux and macOS
|
| HiQPdf Next for .NET is delivered as NuGet packages for Windows, Linux and macOS.
The packages include the .NET Standard 2.0 library, the same for both platforms,
and the specific native runtime for each platform.
|
|
|
|
ASP.NET Core Demo Application with C# Code for All Features
|
| The zip package that can be downloaded from the website contains
the project for the ASP.NET Core demo application with C# sample code
for all major library features.
|
|
|
|
Simple and Flexible Licensing with a Single License for All Libraries
|
| The license for HiQPdf Next for .NET works with both the
classic HiQPdf Library for .NET and the multi-platform client-server solution.
There are no additional runtime or deployment costs charged for using our software
component in your applications.
|
|
|