From 32208f47996dbb864ffaef5537bbd8c74ddebbb5 Mon Sep 17 00:00:00 2001 From: Gregor Beyerle Date: Mon, 28 Oct 2019 23:06:39 +0100 Subject: [PATCH] Cannot render tables (#24) * Replace CommonMark.Net with minimally configured Markdig * Add pipe table extension and link Markdig documentation --- paket.dependencies | 2 +- paket.lock | 36 +++++++++++++++++-- .../posts/2017-05-31-test-styles.md | 29 ++++++++++++++- src/Fornax/AssemblyInfo.fs | 2 +- src/Fornax/Generator.fs | 13 +++++-- src/Fornax/paket.references | 2 +- 6 files changed, 75 insertions(+), 9 deletions(-) diff --git a/paket.dependencies b/paket.dependencies index 1051855..804f748 100644 --- a/paket.dependencies +++ b/paket.dependencies @@ -11,7 +11,7 @@ nuget FSharp.Quotations.Evaluator nuget Argu nuget Suave -nuget CommonMark.NET +nuget Markdig nuget dotless.Core nuget YamlDotNet diff --git a/paket.lock b/paket.lock index 1f4b296..a8ae80d 100644 --- a/paket.lock +++ b/paket.lock @@ -5,7 +5,6 @@ NUGET FSharp.Core (>= 4.0.0.1) - restriction: >= net45 FSharp.Core (>= 4.3.2) - restriction: && (< net45) (>= netstandard2.0) System.Configuration.ConfigurationManager (>= 4.4) - restriction: && (< net45) (>= netstandard2.0) - CommonMark.NET (0.15.1) dotless.Core (1.6.7) Microsoft.Extensions.DependencyInjection (>= 1.1.1) - restriction: || (&& (>= net45) (< net461) (< netstandard2.0)) (&& (>= net461) (< net47) (< netstandard2.0)) Microsoft.Extensions.DependencyInjection (>= 2.1.1) - restriction: || (&& (< net45) (>= netstandard2.0)) (>= net47) @@ -28,11 +27,27 @@ NUGET FSharp.Quotations.Evaluator (1.1.3) FSharp.Core (>= 3.0.2) - restriction: >= net45 FSharp.Core (>= 4.3.1) - restriction: && (< net45) (>= netstandard2.0) + Markdig (0.18) + Microsoft.NETCore.UniversalWindowsPlatform (>= 5.2.2) - restriction: >= uap10.0 Microsoft.Extensions.DependencyInjection (3.0) - restriction: || (&& (>= net45) (< net461) (< netstandard2.0)) (&& (< net45) (>= netstandard2.0)) (&& (>= net461) (< netstandard2.0)) (>= net47) Microsoft.Extensions.DependencyInjection.Abstractions (>= 3.0) - restriction: || (>= net461) (>= netstandard2.0) Microsoft.Extensions.DependencyInjection.Abstractions (3.0) - restriction: || (&& (< net45) (>= netstandard2.0)) (&& (>= net461) (< netstandard2.0)) (>= net47) - Microsoft.NETCore.Platforms (3.0) - restriction: || (&& (< monoandroid) (< net45) (< netstandard1.2) (>= netstandard2.0) (< win8)) (&& (< monoandroid) (< net45) (< netstandard1.3) (>= netstandard2.0) (< win8) (< wpa81)) (&& (< monoandroid) (< net45) (< netstandard1.4) (>= netstandard2.0) (< win8) (< wpa81)) (&& (< monoandroid) (< net45) (< netstandard1.5) (>= netstandard2.0) (< win8) (< wpa81)) (&& (< monoandroid) (< net45) (< netstandard1.6) (>= netstandard2.0) (< win8) (< wpa81)) (&& (< monoandroid) (< net45) (>= netstandard2.0) (< xamarinios) (< xamarinmac)) (&& (>= monotouch) (>= netcoreapp2.1)) (&& (< net45) (>= net463) (>= netstandard2.0)) (&& (>= net461) (>= netcoreapp2.1)) (>= netcoreapp2.0) (&& (>= netcoreapp2.1) (< netcoreapp3.0)) (&& (>= netcoreapp2.1) (>= xamarintvos)) (&& (>= netcoreapp2.1) (>= xamarinwatchos)) + Microsoft.Net.Native.Compiler (2.2.7-rel-27913-00) - restriction: >= uap10.1 + runtime.win10-arm.Microsoft.Net.Native.Compiler (>= 2.2.7-rel-27913-00) + runtime.win10-arm64.Microsoft.Net.Native.Compiler (>= 2.2.7-rel-27913-00) + runtime.win10-x64.Microsoft.Net.Native.Compiler (>= 2.2.7-rel-27913-00) + runtime.win10-x86.Microsoft.Net.Native.Compiler (>= 2.2.7-rel-27913-00) + Microsoft.Net.UWPCoreRuntimeSdk (2.2.9) - restriction: >= uap10.1 + runtime.win10-arm.Microsoft.Net.UWPCoreRuntimeSdk (>= 2.2.9) - restriction: >= uap10.1 + runtime.win10-x64.Microsoft.Net.UWPCoreRuntimeSdk (>= 2.2.9) - restriction: >= uap10.1 + runtime.win10-x86.Microsoft.Net.UWPCoreRuntimeSdk (>= 2.2.9) - restriction: >= uap10.1 + Microsoft.NETCore.Platforms (3.0) - restriction: || (&& (< monoandroid) (< net45) (< netstandard1.2) (>= netstandard2.0) (< win8)) (&& (< monoandroid) (< net45) (< netstandard1.3) (>= netstandard2.0) (< win8) (< wpa81)) (&& (< monoandroid) (< net45) (< netstandard1.4) (>= netstandard2.0) (< win8) (< wpa81)) (&& (< monoandroid) (< net45) (< netstandard1.5) (>= netstandard2.0) (< win8) (< wpa81)) (&& (< monoandroid) (< net45) (< netstandard1.6) (>= netstandard2.0) (< win8) (< wpa81)) (&& (< monoandroid) (< net45) (>= netstandard2.0) (< xamarinios) (< xamarinmac)) (&& (>= monotouch) (>= netcoreapp2.1)) (&& (< net45) (>= net463) (>= netstandard2.0)) (&& (>= net461) (>= netcoreapp2.1)) (>= netcoreapp2.0) (&& (>= netcoreapp2.1) (< netcoreapp3.0)) (&& (>= netcoreapp2.1) (>= xamarintvos)) (&& (>= netcoreapp2.1) (>= xamarinwatchos)) (>= uap10.1) Microsoft.NETCore.Targets (3.0) - restriction: || (&& (< monoandroid) (< net45) (< netstandard1.2) (>= netstandard2.0) (< win8)) (&& (< monoandroid) (< net45) (< netstandard1.3) (>= netstandard2.0) (< win8) (< wpa81)) (&& (< monoandroid) (< net45) (< netstandard1.4) (>= netstandard2.0) (< win8) (< wpa81)) (&& (< monoandroid) (< net45) (< netstandard1.5) (>= netstandard2.0) (< win8) (< wpa81)) (&& (< monoandroid) (< net45) (< netstandard1.6) (>= netstandard2.0) (< win8) (< wpa81)) (&& (< monoandroid) (< net45) (>= netstandard2.0) (< xamarinios) (< xamarinmac)) (&& (< net45) (>= net463) (>= netstandard2.0)) + Microsoft.NETCore.UniversalWindowsPlatform (6.2.9) - restriction: >= uap10.0 + Microsoft.Net.Native.Compiler (>= 2.2.7-rel-27913-00) - restriction: >= uap10.1 + Microsoft.Net.UWPCoreRuntimeSdk (>= 2.2.9) - restriction: >= uap10.1 + Microsoft.NETCore.Platforms (>= 2.1) - restriction: >= uap10.1 + NETStandard.Library (>= 2.0.3) - restriction: >= uap10.1 Microsoft.Win32.Primitives (4.3) - restriction: && (< monoandroid) (< net45) (>= netstandard2.0) (< xamarinios) (< xamarinmac) Microsoft.NETCore.Platforms (>= 1.1) - restriction: && (< monoandroid) (< monotouch) (< net46) (>= netstandard1.3) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos) Microsoft.NETCore.Targets (>= 1.1) - restriction: && (< monoandroid) (< monotouch) (< net46) (>= netstandard1.3) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos) @@ -45,6 +60,8 @@ NUGET Microsoft.Win32.SystemEvents (4.6) - restriction: >= netcoreapp2.0 Microsoft.NETCore.Platforms (>= 3.0) - restriction: >= netcoreapp2.0 Mono.Cecil (0.11) - restriction: || (>= net461) (>= netstandard2.0) + NETStandard.Library (2.0.3) - restriction: >= uap10.1 + Microsoft.NETCore.Platforms (>= 1.1) - restriction: || (&& (>= net45) (< netstandard1.3)) (&& (< net45) (>= netstandard1.1) (< netstandard1.2) (< win8)) (&& (< net45) (>= netstandard1.2) (< netstandard1.3) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.4) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.4) (< netstandard1.5) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.5) (< netstandard1.6) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.6) (< netstandard2.0) (< win8) (< wpa81)) (&& (< net45) (>= netstandard2.0)) (&& (>= net46) (< netstandard1.4)) (>= net461) (>= netcoreapp2.0) (&& (>= netstandard1.0) (< portable-net45+win8+wpa81)) (&& (< netstandard1.0) (>= portable-net45+win8) (< win8)) (&& (< netstandard1.0) (< portable-net45+win8) (>= portable-net45+win8+wpa81)) (&& (< netstandard1.0) (>= portable-net45+win8+wp8+wpa81) (< portable-net45+win8+wpa81)) (&& (< netstandard1.0) (>= win8)) (&& (< netstandard1.3) (< win8) (>= wpa81)) (&& (< netstandard1.5) (>= uap10.0)) (>= uap10.1) (>= wp8) runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - restriction: && (< monoandroid) (< net45) (>= netstandard2.0) (< xamarinios) (< xamarinmac) runtime.debian.9-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - restriction: && (< monoandroid) (< net45) (>= netstandard2.0) (< xamarinios) (< xamarinmac) runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - restriction: && (< monoandroid) (< net45) (>= netstandard2.0) (< xamarinios) (< xamarinmac) @@ -82,6 +99,21 @@ NUGET runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - restriction: && (< monoandroid) (< net45) (>= netstandard2.0) (< xamarinios) (< xamarinmac) runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - restriction: && (< monoandroid) (< net45) (>= netstandard2.0) (< xamarinios) (< xamarinmac) runtime.ubuntu.18.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - restriction: && (< monoandroid) (< net45) (>= netstandard2.0) (< xamarinios) (< xamarinmac) + runtime.win10-arm.Microsoft.Net.Native.Compiler (2.2.7-rel-27913-00) - restriction: >= uap10.1 + runtime.win10-arm.Microsoft.Net.Native.SharedLibrary (>= 2.2.7-rel-27913-00) + runtime.win10-arm.Microsoft.Net.Native.SharedLibrary (2.2.7-rel-27913-00) - restriction: >= uap10.1 + runtime.win10-arm.Microsoft.Net.UWPCoreRuntimeSdk (2.2.9) - restriction: >= uap10.1 + runtime.win10-arm64.Microsoft.Net.Native.Compiler (2.2.7-rel-27913-00) - restriction: >= uap10.1 + runtime.win10-arm64.Microsoft.Net.Native.SharedLibrary (>= 2.2.7-rel-27913-00) + runtime.win10-arm64.Microsoft.Net.Native.SharedLibrary (2.2.7-rel-27913-00) - restriction: >= uap10.1 + runtime.win10-x64.Microsoft.Net.Native.Compiler (2.2.7-rel-27913-00) - restriction: >= uap10.1 + runtime.win10-x64.Microsoft.Net.Native.SharedLibrary (>= 2.2.7-rel-27913-00) + runtime.win10-x64.Microsoft.Net.Native.SharedLibrary (2.2.7-rel-27913-00) - restriction: >= uap10.1 + runtime.win10-x64.Microsoft.Net.UWPCoreRuntimeSdk (2.2.9) - restriction: >= uap10.1 + runtime.win10-x86.Microsoft.Net.Native.Compiler (2.2.7-rel-27913-00) - restriction: >= uap10.1 + runtime.win10-x86.Microsoft.Net.Native.SharedLibrary (>= 2.2.7-rel-27913-00) + runtime.win10-x86.Microsoft.Net.Native.SharedLibrary (2.2.7-rel-27913-00) - restriction: >= uap10.1 + runtime.win10-x86.Microsoft.Net.UWPCoreRuntimeSdk (2.2.9) - restriction: >= uap10.1 Suave (2.5.6) FSharp.Core (>= 4.3.4) - restriction: || (>= net461) (>= netstandard2.0) System.Buffers (4.5) - restriction: || (&& (< monoandroid) (< netstandard1.1) (>= netstandard2.0) (< win8)) (&& (>= monotouch) (>= net46)) (&& (>= monotouch) (>= netstandard2.0)) (&& (>= net45) (>= uap10.1)) (&& (< net45) (>= net46) (>= netstandard2.0)) (&& (< net45) (< netcoreapp2.0) (>= netstandard2.0) (< xamarinios) (< xamarinmac)) (&& (>= net46) (< netstandard1.1)) (&& (>= net46) (< netstandard2.0)) (&& (>= net46) (>= xamarinios)) (&& (>= net46) (>= xamarinmac)) (&& (>= net46) (>= xamarintvos)) (&& (>= net46) (>= xamarinwatchos)) (>= net461) (&& (< netstandard1.1) (>= netstandard2.0) (>= win8)) (&& (>= netstandard2.0) (>= uap10.1)) (&& (>= netstandard2.0) (>= xamarintvos)) (&& (>= netstandard2.0) (>= xamarinwatchos)) (&& (>= uap10.1) (>= xamarinios)) (&& (>= uap10.1) (>= xamarinmac)) diff --git a/src/Fornax.Template/posts/2017-05-31-test-styles.md b/src/Fornax.Template/posts/2017-05-31-test-styles.md index ebdb41b..4089095 100644 --- a/src/Fornax.Template/posts/2017-05-31-test-styles.md +++ b/src/Fornax.Template/posts/2017-05-31-test-styles.md @@ -130,9 +130,13 @@ Quotes from "The Strange Case of Dr. Jekyll and Mr. Hyde": > -- Robert Louis Stevenson - ### Tables +#### Pipe Tables + +The syntax of pipe tables is documented in the [Markdig pipe table extension specification](https://github.com/lunet-io/markdig/blob/master/src/Markdig.Tests/Specs/PipeTableSpecs.md). + +Property | Value ---------------- | ------------------------ Author | Robert Louis Stevenson Original title | Strange Case Of Dr Jekyll And Mr Hyde @@ -144,6 +148,29 @@ Publisher | Longmans, Green & Co. Publication date | 5 January 1886 +#### Grid Tables + +The syntax of grid tables is documented in the [Markdig grid table extension specification](https://github.com/lunet-io/markdig/blob/master/src/Markdig.Tests/Specs/GridTableSpecs.md). + ++------------------+--------------------------------------------------+ +| Author | Robert Louis Stevenson | ++------------------+--------------------------------------------------+ +| Original title | Strange Case Of Dr Jekyll And Mr Hyde | ++------------------+--------------------------------------------------+ +| Country | United Kingdom | ++------------------+--------------------------------------------------+ +| Language | English | ++------------------+--------------------------------------------------+ +| Series | None | ++------------------+--------------------------------------------------+ +| Genre | Drama, Horror, Thriller, Gothic, Science fiction | ++------------------+--------------------------------------------------+ +| Publisher | Longmans, Green & Co. | ++------------------+--------------------------------------------------+ +| Publication date | 5 January 1886 | ++------------------+--------------------------------------------------+ + + ### Code n Code Blocks The `white-space` CSS property is used to to describe diff --git a/src/Fornax/AssemblyInfo.fs b/src/Fornax/AssemblyInfo.fs index acc14f0..c3bef12 100644 --- a/src/Fornax/AssemblyInfo.fs +++ b/src/Fornax/AssemblyInfo.fs @@ -14,4 +14,4 @@ module internal AssemblyVersionInformation = let [] AssemblyProduct = "Fornax" let [] AssemblyDescription = "Fornax is a static site generator using type safe F# DSL to define page layouts" let [] AssemblyVersion = "0.3.0" - let [] AssemblyFileVersion = "0.3.0" \ No newline at end of file + let [] AssemblyFileVersion = "0.3.0" diff --git a/src/Fornax/Generator.fs b/src/Fornax/Generator.fs index c291ac2..dfb555e 100644 --- a/src/Fornax/Generator.fs +++ b/src/Fornax/Generator.fs @@ -189,6 +189,7 @@ module Logger = module ContentParser = open Configuration + open Markdig let private isSeparator (input : string) = input.StartsWith "---" @@ -196,6 +197,12 @@ module ContentParser = let private isLayout (input : string) = input.StartsWith "layout:" + let markdownPipeline = + MarkdownPipelineBuilder() + .UsePipeTables() + .UseGridTables() + .Build() + ///`fileContent` - content of page to parse. Usually whole content of `.md` file ///`modelType` - `System.Type` representing type used as model of the page /// returns tupple of: @@ -209,7 +216,7 @@ module ContentParser = let content = content |> Array.skip 1 |> String.concat "\n" let config = config |> String.concat "\n" - let contentOutput = CommonMark.CommonMarkConverter.Convert content + let contentOutput = Markdown.ToHtml(content, markdownPipeline) let configOutput = Yaml.parse modelType config configOutput, contentOutput @@ -240,14 +247,14 @@ module ContentParser = let _, content = fileContent |> Array.splitAt indexOfSeperator let content = content |> Array.skip 1 |> String.concat "\n" - CommonMark.CommonMarkConverter.Convert content + Markdown.ToHtml(content, markdownPipeline) let containsLayout (fileContent : string) = fileContent.Split '\n' |> Array.exists isLayout let compileMarkdown (fileContent : string) = - CommonMark.CommonMarkConverter.Convert fileContent + Markdown.ToHtml(fileContent, markdownPipeline) type Link = string type Title = string diff --git a/src/Fornax/paket.references b/src/Fornax/paket.references index 56de67c..b78e601 100644 --- a/src/Fornax/paket.references +++ b/src/Fornax/paket.references @@ -3,6 +3,6 @@ Argu Suave FSharp.Compiler.Service FSharp.Quotations.Evaluator -CommonMark.NET +Markdig YamlDotNet dotless.Core \ No newline at end of file