diff --git a/Changelog.md b/Changelog.md index 6d7e87c..c6333d9 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,6 +1,12 @@ # Westwind.AspNetCore Change Log [Nuget](https://www.nuget.org/packages/Westwind.AspNetCore/) • [Github](https://github.com/RickStrahl/Westwind.AspNetCore) + +### Version 3.2.2 + +* **Add Support for Title Detection with === underlines** +Added support for title detection when using a double underscore titles within the first 10 lines of text. Title detection uses Yaml title header first, `#` headers next, and double underscore `===` headers last. + ### Version 3.2 * **Add support for replacing Markdown Engine** diff --git a/SampleWeb/wwwroot/posts/2018/03/23/Testpage.html b/SampleWeb/wwwroot/posts/2018/03/23/Testpage.html deleted file mode 100644 index d0db02f..0000000 --- a/SampleWeb/wwwroot/posts/2018/03/23/Testpage.html +++ /dev/null @@ -1,599 +0,0 @@ ---- -title: Creating an ASP.NET Core Markdown TagHelper and Parser -abstract: A couple of months ago I wrote about creating a WebForms based Markdown control. This time around I'll build an ASP.NET Core MVC TagHelper that performs similar functionality for embedding Markdown text into a content area of a Razor page. The component also includes easy access to a Markdown parser using the blazing fast MarkDig Markdown parser. -keywords: Markdown, TagHelper, ASP.NET Core -categories: ASP.NET Core, Markdown -weblogName: West Wind Web Log -postId: 708211 -postDate: 2018-03-23T01:11:43.8926586-10:00 ---- -# Creating an ASP.NET Core Markdown TagHelper and Parser - -![](ScribeImage.jpg) - -A few months ago I wrote about creating a [literal Markdown Control for WebForms](https://weblog.west-wind.com/posts/2017/Sep/13/A-Literal-Markdown-Control-for-ASPNET-WebForms), where I described a simple content control that takes the content from within a tag and parses the embedded Markdown and then produces HTML output in its stead. I created a WebForms control mainly for selfish reasons, because I have tons of semi-static content on my content sites that still live in classic ASP.NET ASPX pages. - -Since I wrote that article I've gotten a lot of requests to write about an ASP.NET Core version for something similar and - back to my own selfishishness - I'm also starting to deploy a few content heavy sites that have mostly static html content that would be well served by Markdown using ASP.NET Core and Razor Pages. So it's time to build an ASP.NET Core version by creating a `` TagHelper. - -There are already a number of implementations available, but I'm a big fan of the [MarkDig Markdown Parser](https://github.com/lunet-io/markdig), so I set out to create an **ASP.NET Core Tag Helper** that provides the same functionality as the WebForms control I previously created. - -Using the TagHelper you can render Markdown like this inside of a Razor Page: - -```html - - #### This is Markdown text inside of a Markdown block - - * Item 1 - * Item 2 - - ### Dynamic Data is supported: - The current Time is: @DateTime.Now.ToString("HH:mm:ss") - - ```cs - // this c# is a code block - for (int i = 0; i < lines.Length; i++) - { - line1 = lines[i]; - if (!string.IsNullOrEmpty(line1)) - break; - } - ``` - -``` - -The Markdown is expanded into HTML to replace the markdown TagHelper content. - -You can also bind to Model values using the `markdown` attribute: - -```html -@model MarkdownModel - - -``` - -You can also easily parse Markdown both in code and inside of Razor Pages: - -```cs -string html = Markdown.Parse(markdownText) -``` - -Inside of Razor code you can do: - -```html -
@Markdown.ParseHtmlString(Model.ProductInfoMarkdown)
-``` - - -## Get it -The packaged component includes the TagHelper and a simple way to parse Markdown in code or inside of a Razor Page. - -It's available as a [NuGet Package](https://www.nuget.org/packages/Westwind.AspNetCore.Markdown): - -``` -PM> Install-Package Westwind.AspNetCore.Markdown -``` - -And you can take a look at the source code on Github: - -* [Westwind.AspNetCore.Markdown on GitHub](https://github.com/RickStrahl/Westwind.AspNetCorehttps://github.com/RickStrahl/Westwind.AspNetCore) - -## Why do I need a Markdown Control? -Let's take a step back - why would you even need a content control for Markdown Parsing? - -Markdown is everywhere these days and I for one have become incredibly dependent on it for a variety of text scenarios. I use it for blogging, for documentation both for code on Git repos and actual extended documentation. I use it for note keeping and collaboration in Gists or Github Repos, as well as a data entry format for many applications that need to display text content a little bit more richly than using plain text. Since I created the Markdown control I've also been using that extensively for quite a bit of my static content and it's made it much easier to manage some of my content this way. - -### What does it do? -The main reason for this component is the ability to **embed** Markdown into content with a simple tag that gets parsed into HTML at runtime. This is very useful for content pages that contain a lot of raw static text. It's a lot easier to write Markdown text in content pages than it is to write HTML tag soup consisting of `

`,`