From b510385859b8df2b94579295d9b2c8d18989c370 Mon Sep 17 00:00:00 2001 From: Charlie Drewitt Date: Wed, 10 Apr 2019 15:03:27 +0100 Subject: [PATCH 01/11] Updating packages to an available set that works. --- .../MarkdownViewerPlusPlus.csproj | 14 +++++++------- MarkdownViewerPlusPlus/packages.config | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/MarkdownViewerPlusPlus/MarkdownViewerPlusPlus.csproj b/MarkdownViewerPlusPlus/MarkdownViewerPlusPlus.csproj index f7d0eba..ce6c2da 100644 --- a/MarkdownViewerPlusPlus/MarkdownViewerPlusPlus.csproj +++ b/MarkdownViewerPlusPlus/MarkdownViewerPlusPlus.csproj @@ -90,13 +90,13 @@ - ..\packages\HtmlRenderer.Core.1.5.1-beta3\lib\net40-client\HtmlRenderer.dll + ..\packages\HtmlRenderer.Core.1.5.1-beta1\lib\net40-client\HtmlRenderer.dll - ..\packages\HtmlRenderer.PdfSharp.1.5.1-beta3\lib\net40-client\HtmlRenderer.PdfSharp.dll + ..\packages\HtmlRenderer.PdfSharp.1.5.1-beta1\lib\net40-client\HtmlRenderer.PdfSharp.dll - ..\packages\HtmlRenderer.WinForms.1.5.1-beta3\lib\net40-client\HtmlRenderer.WinForms.dll + ..\packages\HtmlRenderer.WinForms.1.5.1-beta1\lib\net40-client\HtmlRenderer.WinForms.dll ..\packages\Markdig.0.15.0\lib\net40\Markdig.dll @@ -105,11 +105,11 @@ True - - ..\packages\PDFsharp.1.50.4845-RC2a\lib\net20\PdfSharp.dll + + ..\packages\PDFsharp.1.50.4000-beta3b\lib\net20\PdfSharp.dll - - ..\packages\PDFsharp.1.50.4845-RC2a\lib\net20\PdfSharp.Charting.dll + + ..\packages\PDFsharp.1.50.4000-beta3b\lib\net20\PdfSharp.Charting.dll diff --git a/MarkdownViewerPlusPlus/packages.config b/MarkdownViewerPlusPlus/packages.config index 3075f92..adf5605 100644 --- a/MarkdownViewerPlusPlus/packages.config +++ b/MarkdownViewerPlusPlus/packages.config @@ -1,12 +1,12 @@  - - - + + + - + \ No newline at end of file From e13de356d5dc9ee6c31bb8a14cf6f727883e2e5a Mon Sep 17 00:00:00 2001 From: Charlie Drewitt Date: Thu, 11 Apr 2019 15:44:15 +0100 Subject: [PATCH 02/11] Using default System.Windows.Forms.WebBrowser control for HTML rendering instead of --- .../Forms/MarkdownViewerRenderer.cs | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/MarkdownViewerPlusPlus/Forms/MarkdownViewerRenderer.cs b/MarkdownViewerPlusPlus/Forms/MarkdownViewerRenderer.cs index 7033764..dbb6b62 100644 --- a/MarkdownViewerPlusPlus/Forms/MarkdownViewerRenderer.cs +++ b/MarkdownViewerPlusPlus/Forms/MarkdownViewerRenderer.cs @@ -7,6 +7,7 @@ using System.Threading; using TheArtOfDev.HtmlRenderer.Core.Entities; using static com.insanitydesign.MarkdownViewerPlusPlus.MarkdownViewer; +using System.Windows.Forms; /// /// @@ -18,10 +19,7 @@ namespace com.insanitydesign.MarkdownViewerPlusPlus.Forms /// public class MarkdownViewerRenderer : AbstractRenderer { - /// - /// - /// - public MarkdownViewerHtmlPanel markdownViewerHtmlPanel; + public WebBrowser browser; /// /// @@ -37,13 +35,17 @@ public MarkdownViewerRenderer(MarkdownViewer markdownViewer) : base(markdownView protected override void Init() { base.Init(); - // - this.markdownViewerHtmlPanel = new MarkdownViewerHtmlPanel(); + + this.browser = new WebBrowser + { + Dock = DockStyle.Fill + }; + //Add a custom image loader - this.markdownViewerHtmlPanel.ImageLoad += OnImageLoad; + //Add to view - this.Controls.Add(this.markdownViewerHtmlPanel); - this.Controls.SetChildIndex(this.markdownViewerHtmlPanel, 0); + this.Controls.Add(this.browser); + this.Controls.SetChildIndex(this.browser, 0); } /// @@ -54,7 +56,7 @@ protected override void Init() public override void Render(string text, FileInformation fileInfo) { base.Render(text, fileInfo); - this.markdownViewerHtmlPanel.Text = BuildHtml(ConvertedText, fileInfo.FileName); + this.browser.DocumentText = BuildHtml(ConvertedText, fileInfo.FileName); } /// @@ -64,7 +66,7 @@ public override void Render(string text, FileInformation fileInfo) /// public override void ScrollByRatioVertically(double scrollRatio) { - this.markdownViewerHtmlPanel.ScrollByRatioVertically(scrollRatio); + } /// @@ -181,10 +183,6 @@ protected void OnDownloadDataCompleted(DownloadDataCompletedEventArgs downloadEv /// protected override void Dispose(bool disposing) { - if (this.markdownViewerHtmlPanel != null) - { - this.markdownViewerHtmlPanel.ImageLoad -= OnImageLoad; - } base.Dispose(disposing); } } From 9c8f929b3c2c39da4137445dd90977a9a97cb3ec Mon Sep 17 00:00:00 2001 From: Charlie Drewitt Date: Thu, 11 Apr 2019 15:44:53 +0100 Subject: [PATCH 03/11] Removing reference to HtmlRendere --- .../Forms/AbstractRenderer.cs | 6 +- .../Forms/MarkdownViewerHtmlPanel.cs | 67 ------------------- .../MarkdownViewerPlusPlus.csproj | 6 -- MarkdownViewerPlusPlus/packages.config | 1 - 4 files changed, 5 insertions(+), 75 deletions(-) delete mode 100644 MarkdownViewerPlusPlus/Forms/MarkdownViewerHtmlPanel.cs diff --git a/MarkdownViewerPlusPlus/Forms/AbstractRenderer.cs b/MarkdownViewerPlusPlus/Forms/AbstractRenderer.cs index 16ecb8d..64303b1 100644 --- a/MarkdownViewerPlusPlus/Forms/AbstractRenderer.cs +++ b/MarkdownViewerPlusPlus/Forms/AbstractRenderer.cs @@ -67,7 +67,10 @@ public abstract partial class AbstractRenderer : Form /// /// /// - protected MarkdownPipeline markdownPipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build(); + protected MarkdownPipeline markdownPipeline = new MarkdownPipelineBuilder() + .UseAdvancedExtensions() + .UseBootstrap() + .Build(); /// /// @@ -192,6 +195,7 @@ protected string BuildHtml(string html = "", string title = "") {title} + diff --git a/MarkdownViewerPlusPlus/Forms/MarkdownViewerHtmlPanel.cs b/MarkdownViewerPlusPlus/Forms/MarkdownViewerHtmlPanel.cs deleted file mode 100644 index 3169a0a..0000000 --- a/MarkdownViewerPlusPlus/Forms/MarkdownViewerHtmlPanel.cs +++ /dev/null @@ -1,67 +0,0 @@ -using TheArtOfDev.HtmlRenderer.WinForms; - -/// -/// -/// -namespace com.insanitydesign.MarkdownViewerPlusPlus.Forms -{ - /// - /// - /// - public class MarkdownViewerHtmlPanel : HtmlPanel - { - /// - /// - /// - public MarkdownViewerHtmlPanel() - { - this.AllowDrop = false; - this.Dock = System.Windows.Forms.DockStyle.Fill; - this.IsContextMenuEnabled = false; - this.Location = new System.Drawing.Point(0, 24); - this.MinimumSize = new System.Drawing.Size(20, 20); - this.Name = "markdownViewerHtmlPanel"; - this.Size = new System.Drawing.Size(284, 237); - this.TabIndex = 0; - this.AvoidImagesLateLoading = false; - } - - /// - /// - /// - public override string Text { - get { return _text; } - set { - _text = value; - if (!IsDisposed) - { - _htmlContainer.SetHtml(_text, _baseCssData); - Redraw(); - } - } - } - - /// - /// Scroll by the given ratio, calculated with max and page - /// - /// - public void ScrollByRatioVertically(double scrollRatio) - { - if (!IsDisposed) - { - VerticalScroll.Value = (int)((VerticalScroll.Maximum - VerticalScroll.LargeChange) * scrollRatio); - Redraw(); - } - } - - /// - /// - /// - protected void Redraw() - { - PerformLayout(); - Invalidate(); - InvokeMouseMove(); - } - } -} diff --git a/MarkdownViewerPlusPlus/MarkdownViewerPlusPlus.csproj b/MarkdownViewerPlusPlus/MarkdownViewerPlusPlus.csproj index ce6c2da..7f5c3b8 100644 --- a/MarkdownViewerPlusPlus/MarkdownViewerPlusPlus.csproj +++ b/MarkdownViewerPlusPlus/MarkdownViewerPlusPlus.csproj @@ -95,9 +95,6 @@ ..\packages\HtmlRenderer.PdfSharp.1.5.1-beta1\lib\net40-client\HtmlRenderer.PdfSharp.dll - - ..\packages\HtmlRenderer.WinForms.1.5.1-beta1\lib\net40-client\HtmlRenderer.WinForms.dll - ..\packages\Markdig.0.15.0\lib\net40\Markdig.dll @@ -140,9 +137,6 @@ AbstractRenderer.cs - - Component - Form diff --git a/MarkdownViewerPlusPlus/packages.config b/MarkdownViewerPlusPlus/packages.config index adf5605..1d69c5b 100644 --- a/MarkdownViewerPlusPlus/packages.config +++ b/MarkdownViewerPlusPlus/packages.config @@ -2,7 +2,6 @@ - From 9728088ce50b5f15cbe83ff680f4979e77853585 Mon Sep 17 00:00:00 2001 From: Charlie Drewitt Date: Thu, 11 Apr 2019 15:46:35 +0100 Subject: [PATCH 04/11] Revert "Removing reference to HtmlRendere" This reverts commit 9c8f929b3c2c39da4137445dd90977a9a97cb3ec. --- .../Forms/AbstractRenderer.cs | 6 +- .../Forms/MarkdownViewerHtmlPanel.cs | 67 +++++++++++++++++++ .../MarkdownViewerPlusPlus.csproj | 6 ++ MarkdownViewerPlusPlus/packages.config | 1 + 4 files changed, 75 insertions(+), 5 deletions(-) create mode 100644 MarkdownViewerPlusPlus/Forms/MarkdownViewerHtmlPanel.cs diff --git a/MarkdownViewerPlusPlus/Forms/AbstractRenderer.cs b/MarkdownViewerPlusPlus/Forms/AbstractRenderer.cs index 64303b1..16ecb8d 100644 --- a/MarkdownViewerPlusPlus/Forms/AbstractRenderer.cs +++ b/MarkdownViewerPlusPlus/Forms/AbstractRenderer.cs @@ -67,10 +67,7 @@ public abstract partial class AbstractRenderer : Form /// /// /// - protected MarkdownPipeline markdownPipeline = new MarkdownPipelineBuilder() - .UseAdvancedExtensions() - .UseBootstrap() - .Build(); + protected MarkdownPipeline markdownPipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build(); /// /// @@ -195,7 +192,6 @@ protected string BuildHtml(string html = "", string title = "") {title} - diff --git a/MarkdownViewerPlusPlus/Forms/MarkdownViewerHtmlPanel.cs b/MarkdownViewerPlusPlus/Forms/MarkdownViewerHtmlPanel.cs new file mode 100644 index 0000000..3169a0a --- /dev/null +++ b/MarkdownViewerPlusPlus/Forms/MarkdownViewerHtmlPanel.cs @@ -0,0 +1,67 @@ +using TheArtOfDev.HtmlRenderer.WinForms; + +/// +/// +/// +namespace com.insanitydesign.MarkdownViewerPlusPlus.Forms +{ + /// + /// + /// + public class MarkdownViewerHtmlPanel : HtmlPanel + { + /// + /// + /// + public MarkdownViewerHtmlPanel() + { + this.AllowDrop = false; + this.Dock = System.Windows.Forms.DockStyle.Fill; + this.IsContextMenuEnabled = false; + this.Location = new System.Drawing.Point(0, 24); + this.MinimumSize = new System.Drawing.Size(20, 20); + this.Name = "markdownViewerHtmlPanel"; + this.Size = new System.Drawing.Size(284, 237); + this.TabIndex = 0; + this.AvoidImagesLateLoading = false; + } + + /// + /// + /// + public override string Text { + get { return _text; } + set { + _text = value; + if (!IsDisposed) + { + _htmlContainer.SetHtml(_text, _baseCssData); + Redraw(); + } + } + } + + /// + /// Scroll by the given ratio, calculated with max and page + /// + /// + public void ScrollByRatioVertically(double scrollRatio) + { + if (!IsDisposed) + { + VerticalScroll.Value = (int)((VerticalScroll.Maximum - VerticalScroll.LargeChange) * scrollRatio); + Redraw(); + } + } + + /// + /// + /// + protected void Redraw() + { + PerformLayout(); + Invalidate(); + InvokeMouseMove(); + } + } +} diff --git a/MarkdownViewerPlusPlus/MarkdownViewerPlusPlus.csproj b/MarkdownViewerPlusPlus/MarkdownViewerPlusPlus.csproj index 7f5c3b8..ce6c2da 100644 --- a/MarkdownViewerPlusPlus/MarkdownViewerPlusPlus.csproj +++ b/MarkdownViewerPlusPlus/MarkdownViewerPlusPlus.csproj @@ -95,6 +95,9 @@ ..\packages\HtmlRenderer.PdfSharp.1.5.1-beta1\lib\net40-client\HtmlRenderer.PdfSharp.dll + + ..\packages\HtmlRenderer.WinForms.1.5.1-beta1\lib\net40-client\HtmlRenderer.WinForms.dll + ..\packages\Markdig.0.15.0\lib\net40\Markdig.dll @@ -137,6 +140,9 @@ AbstractRenderer.cs + + Component + Form diff --git a/MarkdownViewerPlusPlus/packages.config b/MarkdownViewerPlusPlus/packages.config index 1d69c5b..adf5605 100644 --- a/MarkdownViewerPlusPlus/packages.config +++ b/MarkdownViewerPlusPlus/packages.config @@ -2,6 +2,7 @@ + From 1b37e1a6f8bd7a27e8352bf2a6719c89f5336bbf Mon Sep 17 00:00:00 2001 From: Charlie Drewitt Date: Thu, 11 Apr 2019 15:48:42 +0100 Subject: [PATCH 05/11] Removing dependency on HtmlRenderer.WinForms and removing the MarkdownViewerHtmlPanel control and this has been replaced with WebBrowser. --- .../Forms/MarkdownViewerHtmlPanel.cs | 67 ------------------- .../MarkdownViewerPlusPlus.csproj | 6 -- 2 files changed, 73 deletions(-) delete mode 100644 MarkdownViewerPlusPlus/Forms/MarkdownViewerHtmlPanel.cs diff --git a/MarkdownViewerPlusPlus/Forms/MarkdownViewerHtmlPanel.cs b/MarkdownViewerPlusPlus/Forms/MarkdownViewerHtmlPanel.cs deleted file mode 100644 index 3169a0a..0000000 --- a/MarkdownViewerPlusPlus/Forms/MarkdownViewerHtmlPanel.cs +++ /dev/null @@ -1,67 +0,0 @@ -using TheArtOfDev.HtmlRenderer.WinForms; - -/// -/// -/// -namespace com.insanitydesign.MarkdownViewerPlusPlus.Forms -{ - /// - /// - /// - public class MarkdownViewerHtmlPanel : HtmlPanel - { - /// - /// - /// - public MarkdownViewerHtmlPanel() - { - this.AllowDrop = false; - this.Dock = System.Windows.Forms.DockStyle.Fill; - this.IsContextMenuEnabled = false; - this.Location = new System.Drawing.Point(0, 24); - this.MinimumSize = new System.Drawing.Size(20, 20); - this.Name = "markdownViewerHtmlPanel"; - this.Size = new System.Drawing.Size(284, 237); - this.TabIndex = 0; - this.AvoidImagesLateLoading = false; - } - - /// - /// - /// - public override string Text { - get { return _text; } - set { - _text = value; - if (!IsDisposed) - { - _htmlContainer.SetHtml(_text, _baseCssData); - Redraw(); - } - } - } - - /// - /// Scroll by the given ratio, calculated with max and page - /// - /// - public void ScrollByRatioVertically(double scrollRatio) - { - if (!IsDisposed) - { - VerticalScroll.Value = (int)((VerticalScroll.Maximum - VerticalScroll.LargeChange) * scrollRatio); - Redraw(); - } - } - - /// - /// - /// - protected void Redraw() - { - PerformLayout(); - Invalidate(); - InvokeMouseMove(); - } - } -} diff --git a/MarkdownViewerPlusPlus/MarkdownViewerPlusPlus.csproj b/MarkdownViewerPlusPlus/MarkdownViewerPlusPlus.csproj index ce6c2da..7f5c3b8 100644 --- a/MarkdownViewerPlusPlus/MarkdownViewerPlusPlus.csproj +++ b/MarkdownViewerPlusPlus/MarkdownViewerPlusPlus.csproj @@ -95,9 +95,6 @@ ..\packages\HtmlRenderer.PdfSharp.1.5.1-beta1\lib\net40-client\HtmlRenderer.PdfSharp.dll - - ..\packages\HtmlRenderer.WinForms.1.5.1-beta1\lib\net40-client\HtmlRenderer.WinForms.dll - ..\packages\Markdig.0.15.0\lib\net40\Markdig.dll @@ -140,9 +137,6 @@ AbstractRenderer.cs - - Component - Form From de3bd37cf552366cec994e4f089a71fbeadf9244 Mon Sep 17 00:00:00 2001 From: Charlie Drewitt Date: Thu, 11 Apr 2019 16:01:08 +0100 Subject: [PATCH 06/11] Adding a link to the Bootstrap 3 stylesheet and enabling UseBootstrap Markdig option to get pretty output. --- MarkdownViewerPlusPlus/Forms/AbstractRenderer.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/MarkdownViewerPlusPlus/Forms/AbstractRenderer.cs b/MarkdownViewerPlusPlus/Forms/AbstractRenderer.cs index 16ecb8d..e9225c6 100644 --- a/MarkdownViewerPlusPlus/Forms/AbstractRenderer.cs +++ b/MarkdownViewerPlusPlus/Forms/AbstractRenderer.cs @@ -67,7 +67,10 @@ public abstract partial class AbstractRenderer : Form /// /// /// - protected MarkdownPipeline markdownPipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build(); + protected MarkdownPipeline markdownPipeline = new MarkdownPipelineBuilder() + .UseAdvancedExtensions() + .UseBootstrap() + .Build(); /// /// @@ -192,6 +195,7 @@ protected string BuildHtml(string html = "", string title = "") {title} + From eb4852a8a0639c36d811217c1eafa4a415f8196e Mon Sep 17 00:00:00 2001 From: Charlie Drewitt Date: Thu, 11 Apr 2019 16:05:32 +0100 Subject: [PATCH 07/11] Adding a sample Markdown file which can be opened in Notepad++ to ensure rendering is working correctly. --- MarkdownViewerPlusPlus/Sample.md | 329 +++++++++++++++++++++++++++++++ 1 file changed, 329 insertions(+) create mode 100644 MarkdownViewerPlusPlus/Sample.md diff --git a/MarkdownViewerPlusPlus/Sample.md b/MarkdownViewerPlusPlus/Sample.md new file mode 100644 index 0000000..b8d1bf6 --- /dev/null +++ b/MarkdownViewerPlusPlus/Sample.md @@ -0,0 +1,329 @@ +# Markdown: Syntax + +* [Overview](#overview) + * [Philosophy](#philosophy) + * [Inline HTML](#html) + * [Automatic Escaping for Special Characters](#autoescape) +* [Block Elements](#block) + * [Paragraphs and Line Breaks](#p) + * [Headers](#header) + * [Blockquotes](#blockquote) + * [Lists](#list) + * [Code Blocks](#precode) + * [Horizontal Rules](#hr) +* [Span Elements](#span) + * [Links](#link) + * [Emphasis](#em) + * [Code](#code) + * [Images](#img) +* [Miscellaneous](#misc) + * [Backslash Escapes](#backslash) + * [Automatic Links](#autolink) + + +**Note:** This document is itself written using Markdown; you +can [see the source for it by adding '.text' to the URL](/projects/markdown/syntax.text). + +---- + +## Overview + +### Philosophy + +Markdown is intended to be as easy-to-read and easy-to-write as is feasible. + +Readability, however, is emphasized above all else. A Markdown-formatted +document should be publishable as-is, as plain text, without looking +like it's been marked up with tags or formatting instructions. While +Markdown's syntax has been influenced by several existing text-to-HTML +filters -- including [Setext](http://docutils.sourceforge.net/mirror/setext.html), [atx](http://www.aaronsw.com/2002/atx/), [Textile](http://textism.com/tools/textile/), [reStructuredText](http://docutils.sourceforge.net/rst.html), +[Grutatext](http://www.triptico.com/software/grutatxt.html), and [EtText](http://ettext.taint.org/doc/) -- the single biggest source of +inspiration for Markdown's syntax is the format of plain text email. + +## Block Elements + +### Paragraphs and Line Breaks + +A paragraph is simply one or more consecutive lines of text, separated +by one or more blank lines. (A blank line is any line that looks like a +blank line -- a line containing nothing but spaces or tabs is considered +blank.) Normal paragraphs should not be indented with spaces or tabs. + +The implication of the "one or more consecutive lines of text" rule is +that Markdown supports "hard-wrapped" text paragraphs. This differs +significantly from most other text-to-HTML formatters (including Movable +Type's "Convert Line Breaks" option) which translate every line break +character in a paragraph into a `
` tag. + +When you *do* want to insert a `
` break tag using Markdown, you +end a line with two or more spaces, then type return. + +### Headers + +Markdown supports two styles of headers, [Setext] [1] and [atx] [2]. + +Optionally, you may "close" atx-style headers. This is purely +cosmetic -- you can use this if you think it looks better. The +closing hashes don't even need to match the number of hashes +used to open the header. (The number of opening hashes +determines the header level.) + + +### Blockquotes + +Markdown uses email-style `>` characters for blockquoting. If you're +familiar with quoting passages of text in an email message, then you +know how to create a blockquote in Markdown. It looks best if you hard +wrap the text and put a `>` before every line: + +> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, +> consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. +> Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. +> +> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse +> id sem consectetuer libero luctus adipiscing. + +Markdown allows you to be lazy and only put the `>` before the first +line of a hard-wrapped paragraph: + +> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, +consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. +Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. + +> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse +id sem consectetuer libero luctus adipiscing. + +Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by +adding additional levels of `>`: + +> This is the first level of quoting. +> +> > This is nested blockquote. +> +> Back to the first level. + +Blockquotes can contain other Markdown elements, including headers, lists, +and code blocks: + +> ## This is a header. +> +> 1. This is the first list item. +> 2. This is the second list item. +> +> Here's some example code: +> +> return shell_exec("echo $input | $markdown_script"); + +Any decent text editor should make email-style quoting easy. For +example, with BBEdit, you can make a selection and choose Increase +Quote Level from the Text menu. + + +### Lists + +Markdown supports ordered (numbered) and unordered (bulleted) lists. + +Unordered lists use asterisks, pluses, and hyphens -- interchangably +-- as list markers: + +* Red +* Green +* Blue + +is equivalent to: + ++ Red ++ Green ++ Blue + +and: + +- Red +- Green +- Blue + +Ordered lists use numbers followed by periods: + +1. Bird +2. McHale +3. Parish + +It's important to note that the actual numbers you use to mark the +list have no effect on the HTML output Markdown produces. The HTML +Markdown produces from the above list is: + +If you instead wrote the list in Markdown like this: + +1. Bird +1. McHale +1. Parish + +or even: + +3. Bird +1. McHale +8. Parish + +you'd get the exact same HTML output. The point is, if you want to, +you can use ordinal numbers in your ordered Markdown lists, so that +the numbers in your source match the numbers in your published HTML. +But if you want to be lazy, you don't have to. + +To make lists look nice, you can wrap items with hanging indents: + +* Lorem ipsum dolor sit amet, consectetuer adipiscing elit. + Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, + viverra nec, fringilla in, laoreet vitae, risus. +* Donec sit amet nisl. Aliquam semper ipsum sit amet velit. + Suspendisse id sem consectetuer libero luctus adipiscing. + +But if you want to be lazy, you don't have to: + +* Lorem ipsum dolor sit amet, consectetuer adipiscing elit. +Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, +viverra nec, fringilla in, laoreet vitae, risus. +* Donec sit amet nisl. Aliquam semper ipsum sit amet velit. +Suspendisse id sem consectetuer libero luctus adipiscing. + +List items may consist of multiple paragraphs. Each subsequent +paragraph in a list item must be indented by either 4 spaces +or one tab: + +1. This is a list item with two paragraphs. Lorem ipsum dolor + sit amet, consectetuer adipiscing elit. Aliquam hendrerit + mi posuere lectus. + + Vestibulum enim wisi, viverra nec, fringilla in, laoreet + vitae, risus. Donec sit amet nisl. Aliquam semper ipsum + sit amet velit. + +2. Suspendisse id sem consectetuer libero luctus adipiscing. + +It looks nice if you indent every line of the subsequent +paragraphs, but here again, Markdown will allow you to be +lazy: + +* This is a list item with two paragraphs. + + This is the second paragraph in the list item. You're +only required to indent the first line. Lorem ipsum dolor +sit amet, consectetuer adipiscing elit. + +* Another item in the same list. + +To put a blockquote within a list item, the blockquote's `>` +delimiters need to be indented: + +* A list item with a blockquote: + + > This is a blockquote + > inside a list item. + +To put a code block within a list item, the code block needs +to be indented *twice* -- 8 spaces or two tabs: + +* A list item with a code block: + + + +### Tables +Tables are used to organise tabular data. They are constructed using a header row seperated by pipes +``` +Column 1 | Column 2 | Column 3 +- | - | - +Item 1 | Item 2 | Item 3 +``` +When rendered, they look like this: +Column 1 | Column 2 | Column 3 +- | - | - +Item 1 | Item 2 | Item 3 + +### Task Lists +Tasks list can be used to display a list of things which have (or have not) been completed. + +- [ ] Task 1 +- [ ] Task 2 +- [x] Task 3 + +### Code Blocks + +Pre-formatted code blocks are used for writing about programming or +markup source code. Rather than forming normal paragraphs, the lines +of a code block are interpreted literally. Markdown wraps a code block +in both `
` and `` tags.
+
+To produce a code block in Markdown, simply indent every line of the
+block by at least 4 spaces or 1 tab.
+
+This is a normal paragraph:
+
+    This is a code block.
+
+Here is an example of AppleScript:
+
+    tell application "Foo"
+        beep
+    end tell
+
+A code block continues until it reaches a line that is not indented
+(or the end of the article).
+
+Within a code block, ampersands (`&`) and angle brackets (`<` and `>`)
+are automatically converted into HTML entities. This makes it very
+easy to include example HTML source code using Markdown -- just paste
+it and indent it, and Markdown will handle the hassle of encoding the
+ampersands and angle brackets. For example, this:
+
+    
+
+Regular Markdown syntax is not processed within code blocks. E.g.,
+asterisks are just literal asterisks within a code block. This means
+it's also easy to use Markdown to write about Markdown's own syntax.
+
+```
+tell application "Foo"
+    beep
+end tell
+```
+
+## Span Elements
+
+### Links
+
+Markdown supports two style of links: *inline* and *reference*.
+
+In both styles, the link text is delimited by [square brackets].
+
+To create an inline link, use a set of regular parentheses immediately
+after the link text's closing square bracket. Inside the parentheses,
+put the URL where you want the link to point, along with an *optional*
+title for the link, surrounded in quotes. For example:
+
+This is [an example](http://example.com/) inline link.
+
+[This link](http://example.net/) has no title attribute.
+
+### Emphasis
+
+Markdown treats asterisks (`*`) and underscores (`_`) as indicators of
+emphasis. Text wrapped with one `*` or `_` will be wrapped with an
+HTML `` tag; double `*`'s or `_`'s will be wrapped with an HTML
+`` tag. E.g., this input:
+
+*single asterisks*
+
+_single underscores_
+
+**double asterisks**
+
+__double underscores__
+
+### Code
+
+To indicate a span of code, wrap it with backtick quotes (`` ` ``).
+Unlike a pre-formatted code block, a code span indicates code within a
+normal paragraph. For example:
+
+Use the `printf()` function.
\ No newline at end of file

From 6a018b567669d06c635c1c1730e2b8e8537a3a1a Mon Sep 17 00:00:00 2001
From: Charlie Drewitt 
Date: Fri, 12 Apr 2019 08:44:43 +0100
Subject: [PATCH 08/11] Ignoring .bak files which are created when NPP edits a
 file in the solution directory (the new Sample.md file)

---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
index 2be7f4f..81caab9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,6 +8,7 @@
 *.user
 *.userosscache
 *.sln.docstates
+*.bak
 
 # User-specific files (MonoDevelop/Xamarin Studio)
 *.userprefs

From b03cfd1f2508007fed8f3873eba5487d42c6019e Mon Sep 17 00:00:00 2001
From: Charlie Drewitt 
Date: Fri, 12 Apr 2019 08:45:03 +0100
Subject: [PATCH 09/11] Including .gitignore in solution items.

---
 MarkdownViewerPlusPlus.sln | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/MarkdownViewerPlusPlus.sln b/MarkdownViewerPlusPlus.sln
index 65f8046..ddf2e14 100644
--- a/MarkdownViewerPlusPlus.sln
+++ b/MarkdownViewerPlusPlus.sln
@@ -5,6 +5,11 @@ VisualStudioVersion = 14.0.25420.1
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MarkdownViewerPlusPlus", "MarkdownViewerPlusPlus\MarkdownViewerPlusPlus.csproj", "{E56F6E12-089C-40ED-BCFD-923E5FA121A1}"
 EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3F324CD2-6E27-4AD6-A0C2-9F714F76A956}"
+	ProjectSection(SolutionItems) = preProject
+		.gitignore = .gitignore
+	EndProjectSection
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU

From 6407185887db888c46487cd3caeefec3ab0c601f Mon Sep 17 00:00:00 2001
From: Charlie Drewitt 
Date: Fri, 12 Apr 2019 08:45:59 +0100
Subject: [PATCH 10/11] Preserving scroll position when the source markdown is
 updated and the control is re-rendered.

---
 .../Forms/MarkdownViewerRenderer.cs           | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/MarkdownViewerPlusPlus/Forms/MarkdownViewerRenderer.cs b/MarkdownViewerPlusPlus/Forms/MarkdownViewerRenderer.cs
index dbb6b62..917355c 100644
--- a/MarkdownViewerPlusPlus/Forms/MarkdownViewerRenderer.cs
+++ b/MarkdownViewerPlusPlus/Forms/MarkdownViewerRenderer.cs
@@ -4,6 +4,7 @@
 using System.Drawing;
 using System.Drawing.Imaging;
 using System.Net;
+using System.Linq;
 using System.Threading;
 using TheArtOfDev.HtmlRenderer.Core.Entities;
 using static com.insanitydesign.MarkdownViewerPlusPlus.MarkdownViewer;
@@ -20,6 +21,7 @@ namespace com.insanitydesign.MarkdownViewerPlusPlus.Forms
     public class MarkdownViewerRenderer : AbstractRenderer
     {
         public WebBrowser browser;
+        private int? _previousScrollYPosition = 0;
 
         /// 
         /// 
@@ -56,7 +58,29 @@ protected override void Init()
         public override void Render(string text, FileInformation fileInfo)
         {
             base.Render(text, fileInfo);
+
+            var doc = this.browser.Document?.GetElementsByTagName("HTML")?.OfType();
+
+            if (doc != null && doc.Any())
+            {
+                var htmlElement = doc.First();
+
+                _previousScrollYPosition = htmlElement.ScrollTop;
+            }
+
             this.browser.DocumentText = BuildHtml(ConvertedText, fileInfo.FileName);
+
+            this.browser.DocumentCompleted += OnBrowserDocumentCompleted;
+        }
+
+        private void OnBrowserDocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
+        {
+            var browser = sender as WebBrowser;
+
+            if (_previousScrollYPosition != null)
+            {
+                browser.Document.Window.ScrollTo(0, (int)_previousScrollYPosition);
+            }
         }
 
         /// 

From 414e3cf38ba13a7da9055bb0a8558f5b13074a8a Mon Sep 17 00:00:00 2001
From: Charlie Drewitt 
Date: Fri, 12 Apr 2019 08:46:41 +0100
Subject: [PATCH 11/11] Updated Sample.md to move the tables sample below code
 blocks and the tasks list after the lists features.

---
 MarkdownViewerPlusPlus/Sample.md | 43 +++++++++++++++++---------------
 1 file changed, 23 insertions(+), 20 deletions(-)

diff --git a/MarkdownViewerPlusPlus/Sample.md b/MarkdownViewerPlusPlus/Sample.md
index b8d1bf6..948d80f 100644
--- a/MarkdownViewerPlusPlus/Sample.md
+++ b/MarkdownViewerPlusPlus/Sample.md
@@ -215,45 +215,34 @@ To put a blockquote within a list item, the blockquote's `>`
 delimiters need to be indented:
 
 *   A list item with a blockquote:
-
+ 
     > This is a blockquote
     > inside a list item.
 
 To put a code block within a list item, the code block needs
-to be indented *twice* -- 8 spaces or two tabs:
-
-*   A list item with a code block:
-
+to be indented *twice* -- 8 spaces or two tabs: 
+ 
+*   A list item with a code block: 
+ 
         
 
-### Tables
-Tables are used to organise tabular data. They are constructed using a header row seperated by pipes
-```
-Column 1 | Column 2 | Column 3
-- | - | -
-Item 1 | Item 2 | Item 3
-```
-When rendered, they look like this:
-Column 1 | Column 2 | Column 3
-- | - | -
-Item 1 | Item 2 | Item 3
-
 ### Task Lists
 Tasks list can be used to display a list of things which have (or have not) been completed.
 
 - [ ] Task 1
-- [ ] Task 2
+  - [ ] You can also indent task lists just like normal lists.
+- [ ] Task 2 
 - [x] Task 3
 		
 ### Code Blocks
-
+ 
 Pre-formatted code blocks are used for writing about programming or
 markup source code. Rather than forming normal paragraphs, the lines
 of a code block are interpreted literally. Markdown wraps a code block
 in both `
` and `` tags.
 
 To produce a code block in Markdown, simply indent every line of the
-block by at least 4 spaces or 1 tab.
+block by at least 4 spaces or 1 tab. 
 
 This is a normal paragraph:
 
@@ -288,6 +277,20 @@ tell application "Foo"
 end tell
 ```
 
+### Tables
+Tables are used to organise tabular data. They are constructed using a header row seperated by pipes
+```
+Column 1 | Column 2 | Column 3
+- | - | - 
+Item 1 | Item 2 | Item 3
+```
+When rendered, they look like this:
+
+Column 1 | Column 2 | Column 3 
+- | - | - 
+Item 1 | Item 2 | Item 3
+Row 2 Item 1 | Row 2  Item 2 | Row 2  Item 3
+
 ## Span Elements
 
 ### Links