From eaf5d9408c6187a5234098d3c93e94fee3f17f44 Mon Sep 17 00:00:00 2001 From: Pagwin Date: Mon, 6 Apr 2026 15:36:36 -0400 Subject: [PATCH] Began using Transparent --- src/HTML.hs | 1 + src/IR.hs | 2 ++ src/Markdown.hs | 4 ++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/HTML.hs b/src/HTML.hs index 42efb85..de53ff6 100644 --- a/src/HTML.hs +++ b/src/HTML.hs @@ -54,6 +54,7 @@ elementToHTML (List (L {list_type = Ordered {start_number, style}, items}) attrs elementToHTML (List (L {list_type = Unordered {style}, items}) attrs) = T.concat ["", generateLiElems items, ""] elementToHTML (HTML (HTMLTag {html_content})) = html_content elementToHTML (Paragraph (P snippets) attrs) = T.concat ["", serializeInlineToHTML snippets, "

"] +elementToHTML (Transparent snippets) = serializeInlineToHTML snippets elementToHTML HorizontalRule = "
" elementToHTML (Table _ _) = error "TODO" elementToHTML (Container _ _) = error "TODO" diff --git a/src/IR.hs b/src/IR.hs index 6ecbc3f..3fcec17 100644 --- a/src/IR.hs +++ b/src/IR.hs @@ -13,6 +13,8 @@ data Element | -- Markdown only, DJOT will produce a RawBlock with an html type HTML HTML | Paragraph Paragraph Attrs + | -- to avoid breaking generation when swapping InlineText to Element in Markdown parser + Transparent [InlineText] | HorizontalRule | Table Table Attrs | -- Djot ::: diff --git a/src/Markdown.hs b/src/Markdown.hs index 8f69d01..1aff2b3 100644 --- a/src/Markdown.hs +++ b/src/Markdown.hs @@ -155,7 +155,7 @@ blockquoteBlock = do -- this dance with optional and notFollowedBy is done so we -- aren't accidentally consuming part of a block ending (optional ((notFollowedBy blockEnding) *> lineEnding)) - pure [(Paragraph $ P ret) emptyAttrs] + pure [Transparent ret] -- type of list the parser returns -- parser which grabs the prefix for each item of the list @@ -175,7 +175,7 @@ listBlock list_type prefix child_parser_factory nest_level = do child <- optional $ child_parser_factory $ nest_level + 1 error "TODO, child list handling works different now, child needs to be combined into content" - pure $ LI {content = [Paragraph (P content) emptyAttrs]} + pure $ LI {content = [Transparent content]} unorderedListBlock :: (Logger m, Characters s) => Int -> Parser s m Element unorderedListBlock = listBlock Unordered {style = Nothing} unordered_prefix (\level -> unwrap <$> ((try $ unorderedListBlock level) <|> orderedListBlock level))