Skip to content

Commit

Permalink
Cannot render tables (#24)
Browse files Browse the repository at this point in the history
* Replace CommonMark.Net with minimally configured Markdig

* Add pipe table extension and link Markdig documentation
  • Loading branch information
WalternativE authored and Krzysztof-Cieslak committed Oct 28, 2019
1 parent c45ab4d commit 32208f4
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 9 deletions.
2 changes: 1 addition & 1 deletion paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ nuget FSharp.Quotations.Evaluator
nuget Argu
nuget Suave

nuget CommonMark.NET
nuget Markdig
nuget dotless.Core
nuget YamlDotNet

Expand Down
36 changes: 34 additions & 2 deletions paket.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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))
Expand Down
29 changes: 28 additions & 1 deletion src/Fornax.Template/posts/2017-05-31-test-styles.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Fornax/AssemblyInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ module internal AssemblyVersionInformation =
let [<Literal>] AssemblyProduct = "Fornax"
let [<Literal>] AssemblyDescription = "Fornax is a static site generator using type safe F# DSL to define page layouts"
let [<Literal>] AssemblyVersion = "0.3.0"
let [<Literal>] AssemblyFileVersion = "0.3.0"
let [<Literal>] AssemblyFileVersion = "0.3.0"
13 changes: 10 additions & 3 deletions src/Fornax/Generator.fs
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,20 @@ module Logger =

module ContentParser =
open Configuration
open Markdig

let private isSeparator (input : string) =
input.StartsWith "---"

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:
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Fornax/paket.references
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ Argu
Suave
FSharp.Compiler.Service
FSharp.Quotations.Evaluator
CommonMark.NET
Markdig
YamlDotNet
dotless.Core

0 comments on commit 32208f4

Please sign in to comment.