Converting Markdown to HTML in real time

Writing web content in HTML is time-consuming and laborious. Modern content management systems prefer simpler methods to edit and publish content. One such method is to use Markdown, which is a simple plain text format for writing content. Markdown, as opposed to markup (HTML), is made to be simple to use. It is easily parsed, and good-looking web pages can be generated from it.

Markdown was originally invented by John Gruber at daringfireball.net. Since he allowed anybody to use the specification and extend it, it has become popular, and many extensions exist.

If you want to work with Markdown instead of HTML when you publish web content in your projects, you can do so easily. All you need to do is add two NuGet packages. The Waher.Content.Markdown package contains a Markdown parser that can generate HTML, XAML, and plain text from an extended version of Markdown with multimedia extensions and server-side script support. The Waher.Content.Markdown.Web.UWP package includes a real-time conversion module that the web server can use to convert Markdown files to HTML files in real time, if the browser accepts HTML but not Markdown. All we need to do is add these two packages and include them in the type inventory initialization call at the beginning of the app:

Types.Initialize( 
   typeof(FilesProvider).GetTypeInfo().Assembly, 
   typeof(RuntimeSettings).GetTypeInfo().Assembly, 
   typeof(IContentEncoder).GetTypeInfo().Assembly, 
   typeof(ImageCodec).GetTypeInfo().Assembly, 
   typeof(MarkdownDocument).GetTypeInfo().Assembly, 
   typeof(MarkdownToHtmlConverter).GetTypeInfo().Assembly, 
   typeof(App).GetTypeInfo().Assembly); 
You would use the Waher.Content.Markdown.Web package instead if not developing a UWP application.
You can extend the web server with any number of real-time converters. Each converter can convert one internet content type to another. A converter is a class with a default constructor implementing the Waher.Content.IContentConverter interface. The web server can, furthermore, combine converters dynamically to find conversion paths and more advanced conversion capabilities.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.5.239