From 85bec30eddf7837f3ff60e6cdbd60ff06ca846df Mon Sep 17 00:00:00 2001 From: Dillon Kearns Date: Fri, 20 Aug 2021 20:05:57 -0700 Subject: [PATCH] Update docs and MarkdownCodec plugin to latest elm-markdown. --- examples/docs/elm.json | 2 +- plugins/MarkdownCodec.elm | 32 ++++++++++++++++++++++++-------- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/examples/docs/elm.json b/examples/docs/elm.json index a703fdfd..0a797e78 100644 --- a/examples/docs/elm.json +++ b/examples/docs/elm.json @@ -13,7 +13,7 @@ "avh4/elm-color": "1.0.0", "danyx23/elm-mimetype": "4.0.1", "dillonkearns/elm-bcp47-language-tag": "1.0.1", - "dillonkearns/elm-markdown": "6.0.1", + "dillonkearns/elm-markdown": "7.0.0", "dillonkearns/elm-oembed": "1.0.0", "dillonkearns/elm-rss": "2.0.2", "dillonkearns/elm-sitemap": "1.0.2", diff --git a/plugins/MarkdownCodec.elm b/plugins/MarkdownCodec.elm index adec0c32..27c15039 100644 --- a/plugins/MarkdownCodec.elm +++ b/plugins/MarkdownCodec.elm @@ -233,11 +233,11 @@ codec = Block.HtmlBlock html -> encodeHtmlBlock html - Block.UnorderedList listItems -> - encodeUnorderedList listItems + Block.UnorderedList listSpacing listItems -> + encodeUnorderedList listSpacing listItems - Block.OrderedList int lists -> - encodeOrderedList int lists + Block.OrderedList listSpacing int lists -> + encodeOrderedList listSpacing int lists Block.BlockQuote blocks -> encodeBlockQuote blocks @@ -256,8 +256,8 @@ codec = ) |> S.variant0 Block.ThematicBreak |> S.variant1 Block.HtmlBlock htmlCodec - |> S.variant1 Block.UnorderedList (S.list listItemCodec) - |> S.variant2 Block.OrderedList S.int (S.list (S.list inlineCodec)) + |> S.variant2 Block.UnorderedList listSpacingCodec (S.list listItemCodec) + |> S.variant3 Block.OrderedList listSpacingCodec S.int (S.list (S.list (S.lazy (\() -> codec)))) |> S.variant1 Block.BlockQuote (S.list (S.lazy (\() -> codec))) |> S.variant2 Block.Heading headingCodec (S.list inlineCodec) |> S.variant1 Block.Paragraph (S.list inlineCodec) @@ -271,6 +271,22 @@ codec = |> S.finishCustomType +listSpacingCodec : S.Codec e Block.ListSpacing +listSpacingCodec = + S.customType + (\vLoose vTight value -> + case value of + Block.Loose -> + vLoose + + Block.Tight -> + vTight + ) + |> S.variant0 Block.Loose + |> S.variant0 Block.Tight + |> S.finishCustomType + + tableHeaderCodec : S.Codec Never @@ -419,7 +435,7 @@ htmlAttributeCodec = |> S.finishRecord -listItemCodec : S.Codec Never (Block.ListItem Block.Inline) +listItemCodec : S.Codec Never (Block.ListItem Block.Block) listItemCodec = S.customType (\encodeListItem value -> @@ -427,7 +443,7 @@ listItemCodec = Block.ListItem task children -> encodeListItem task children ) - |> S.variant2 Block.ListItem taskCodec (S.list inlineCodec) + |> S.variant2 Block.ListItem taskCodec (S.list (S.lazy (\() -> codec))) |> S.finishCustomType